-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSEARCH-5164 Introduce a new dialect to always pass the index_options…
….type=hnsw
- Loading branch information
1 parent
ad88854
commit 3986b84
Showing
7 changed files
with
93 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...bernate/search/backend/elasticsearch/dialect/model/impl/Elasticsearch814ModelDialect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.backend.elasticsearch.dialect.model.impl; | ||
|
||
import org.hibernate.search.backend.elasticsearch.types.dsl.provider.impl.Elasticsearch814IndexFieldTypeFactoryProvider; | ||
import org.hibernate.search.backend.elasticsearch.types.dsl.provider.impl.ElasticsearchIndexFieldTypeFactoryProvider; | ||
import org.hibernate.search.backend.elasticsearch.validation.impl.Elasticsearch812PropertyMappingValidatorProvider; | ||
import org.hibernate.search.backend.elasticsearch.validation.impl.ElasticsearchPropertyMappingValidatorProvider; | ||
|
||
import com.google.gson.Gson; | ||
|
||
/** | ||
* The model dialect for Elasticsearch 8.14+. | ||
*/ | ||
public class Elasticsearch814ModelDialect implements ElasticsearchModelDialect { | ||
|
||
@Override | ||
public ElasticsearchIndexFieldTypeFactoryProvider createIndexTypeFieldFactoryProvider(Gson userFacingGson) { | ||
return new Elasticsearch814IndexFieldTypeFactoryProvider( userFacingGson ); | ||
} | ||
|
||
@Override | ||
public ElasticsearchPropertyMappingValidatorProvider createElasticsearchPropertyMappingValidatorProvider() { | ||
return new Elasticsearch812PropertyMappingValidatorProvider(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../elasticsearch/types/dsl/provider/impl/Elasticsearch814IndexFieldTypeFactoryProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.backend.elasticsearch.types.dsl.provider.impl; | ||
|
||
import org.hibernate.search.backend.elasticsearch.types.mapping.impl.Elasticsearch814VectorFieldTypeMappingContributor; | ||
import org.hibernate.search.backend.elasticsearch.types.mapping.impl.ElasticsearchVectorFieldTypeMappingContributor; | ||
|
||
import com.google.gson.Gson; | ||
|
||
/** | ||
* The index field type factory provider for ES8.14+. | ||
*/ | ||
public class Elasticsearch814IndexFieldTypeFactoryProvider extends AbstractIndexFieldTypeFactoryProvider { | ||
|
||
private final Elasticsearch814VectorFieldTypeMappingContributor vectorFieldTypeMappingContributor = | ||
new Elasticsearch814VectorFieldTypeMappingContributor(); | ||
|
||
public Elasticsearch814IndexFieldTypeFactoryProvider(Gson userFacingGson) { | ||
super( userFacingGson ); | ||
} | ||
|
||
@Override | ||
protected ElasticsearchVectorFieldTypeMappingContributor vectorFieldTypeMappingContributor() { | ||
return vectorFieldTypeMappingContributor; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...d/elasticsearch/types/mapping/impl/Elasticsearch814VectorFieldTypeMappingContributor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.backend.elasticsearch.types.mapping.impl; | ||
|
||
public class Elasticsearch814VectorFieldTypeMappingContributor extends Elasticsearch812VectorFieldTypeMappingContributor { | ||
|
||
@Override | ||
protected boolean indexOptionAddCondition(Context context) { | ||
// we want to always add index options and in particular include `hnsw` type. | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters