-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSEARCH-3909 Allow looking up available predicates/sorts/projections/…
…aggregations for each field in the metamodel
- Loading branch information
Showing
42 changed files
with
856 additions
and
117 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
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
23 changes: 23 additions & 0 deletions
23
.../java/org/hibernate/search/backend/elasticsearch/types/ElasticsearchIndexFieldTraits.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,23 @@ | ||
/* | ||
* 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; | ||
|
||
import org.hibernate.search.engine.backend.types.IndexFieldTraits; | ||
|
||
/** | ||
* Constants for the names of Elasticsearch-specific traits that can be exposed by index fields. | ||
* <p> | ||
* Currently empty, because there are no Elasticsearch-specific traits. | ||
* | ||
* @see IndexFieldTraits | ||
*/ | ||
public final class ElasticsearchIndexFieldTraits { | ||
|
||
private ElasticsearchIndexFieldTraits() { | ||
} | ||
|
||
} |
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
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
24 changes: 24 additions & 0 deletions
24
...ucene/src/main/java/org/hibernate/search/backend/lucene/types/LuceneIndexFieldTraits.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,24 @@ | ||
/* | ||
* 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.lucene.types; | ||
|
||
import org.hibernate.search.engine.backend.types.IndexFieldTraits; | ||
|
||
/** | ||
* Constants for the names of Lucene-specific traits that can be exposed by index fields. | ||
* <p> | ||
* Currently empty, because there are no Lucene-specific traits. | ||
* | ||
* @see IndexFieldTraits | ||
*/ | ||
public final class LuceneIndexFieldTraits { | ||
|
||
private LuceneIndexFieldTraits() { | ||
} | ||
|
||
|
||
} |
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
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
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
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
...src/main/java/org/hibernate/search/engine/backend/metamodel/IndexFieldTypeDescriptor.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.engine.backend.metamodel; | ||
|
||
import java.util.Set; | ||
|
||
import org.hibernate.search.engine.backend.types.IndexFieldTraits; | ||
|
||
/** | ||
* The type of a field in the index, | ||
* exposing its various capabilities. | ||
* | ||
* @see IndexFieldDescriptor#type() | ||
* @see IndexValueFieldTypeDescriptor | ||
* @see IndexObjectFieldTypeDescriptor | ||
*/ | ||
public interface IndexFieldTypeDescriptor { | ||
|
||
/** | ||
* @return An (unmodifiable) set of strings | ||
* representing the {@link IndexFieldTraits field traits} | ||
* enabled for fields of this type. | ||
*/ | ||
Set<String> traits(); | ||
|
||
} |
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
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
107 changes: 107 additions & 0 deletions
107
engine/src/main/java/org/hibernate/search/engine/backend/types/IndexFieldTraits.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,107 @@ | ||
/* | ||
* 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.engine.backend.types; | ||
|
||
/** | ||
* Constants for the names of various traits that can be exposed by index fields. | ||
* <p> | ||
* Traits are a representation of what a field can be used for at search time: | ||
* a particular predicate, sort, projections, aggregation... | ||
* <p> | ||
* See also backend-specific traits: {@code org.hibernate.search.backend.lucene.types.LuceneIndexFieldTraits}, | ||
* {@code org.hibernate.search.backend.elasticsearch.types.ElasticsearchIndexFieldTraits}. | ||
* | ||
* @see Predicates | ||
* @see Sorts | ||
* @see Projections | ||
* @see Aggregations | ||
*/ | ||
public final class IndexFieldTraits { | ||
|
||
private IndexFieldTraits() { | ||
} | ||
|
||
/** | ||
* Constants for the names of predicate-related traits that can be exposed by index fields. | ||
* | ||
* @see IndexFieldTraits | ||
*/ | ||
public static class Predicates { | ||
|
||
private Predicates() { | ||
} | ||
|
||
public static String named(String name) { | ||
return "predicate:named:" + name; | ||
} | ||
|
||
public static final String EXISTS = "predicate:exists"; | ||
public static final String KNN = "predicate:knn"; | ||
public static final String MATCH = "predicate:match"; | ||
public static final String NESTED = "predicate:nested"; | ||
public static final String PHRASE = "predicate:phrase"; | ||
public static final String RANGE = "predicate:range"; | ||
public static final String REGEXP = "predicate:regexp"; | ||
public static final String SIMPLE_QUERY_STRING = "predicate:simple-query-string"; | ||
public static final String SPATIAL_WITHIN_BOUNDING_BOX = "predicate:spatial:within-bounding-box"; | ||
public static final String SPATIAL_WITHIN_CIRCLE = "predicate:spatial:within-circle"; | ||
public static final String SPATIAL_WITHIN_POLYGON = "predicate:spatial:within-polygon"; | ||
public static final String TERMS = "predicate:terms"; | ||
public static final String WILDCARD = "predicate:wildcard"; | ||
|
||
} | ||
|
||
/** | ||
* Constants for the names of sort-related traits that can be exposed by index fields. | ||
* | ||
* @see IndexFieldTraits | ||
*/ | ||
public static class Sorts { | ||
|
||
private Sorts() { | ||
} | ||
|
||
public static final String DISTANCE = "sort:distance"; | ||
public static final String FIELD = "sort:field"; | ||
|
||
} | ||
|
||
/** | ||
* Constants for the names of projection-related traits that can be exposed by index fields. | ||
* | ||
* @see IndexFieldTraits | ||
*/ | ||
public static class Projections { | ||
|
||
private Projections() { | ||
} | ||
|
||
|
||
public static final String DISTANCE = "projection:distance"; | ||
public static final String FIELD = "projection:field"; | ||
public static final String HIGHLIGHT = "projection:highlight"; | ||
public static final String OBJECT = "projection:object"; | ||
|
||
} | ||
|
||
/** | ||
* Constants for the names of aggregation-related traits that can be exposed by index fields. | ||
* | ||
* @see IndexFieldTraits | ||
*/ | ||
public static class Aggregations { | ||
|
||
private Aggregations() { | ||
} | ||
|
||
public static final String RANGE = "aggregation:range"; | ||
public static final String TERMS = "aggregation:terms"; | ||
|
||
} | ||
|
||
|
||
} |
Oops, something went wrong.