Class AbstractOpenSearchQueryBuilder<T extends SearchQuery>
java.lang.Object
org.opencastproject.opensearch.impl.AbstractOpenSearchQueryBuilder<T>
- All Implemented Interfaces:
org.opensearch.core.common.io.stream.NamedWriteable,org.opensearch.core.common.io.stream.Writeable,org.opensearch.core.xcontent.ToXContent,org.opensearch.core.xcontent.ToXContentObject,org.opensearch.index.query.QueryBuilder,org.opensearch.index.query.Rewriteable<org.opensearch.index.query.QueryBuilder>
- Direct Known Subclasses:
EventQueryBuilder,SeriesQueryBuilder
public abstract class AbstractOpenSearchQueryBuilder<T extends SearchQuery>
extends Object
implements org.opensearch.index.query.QueryBuilder
Opencast implementation of the OpenSearch query builder.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classUtility class to hold date range specifications and turn them into OpenSearch queries.static final classStores a group of values which will later be added to the query using AND.Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringFilter expressionprotected booleanFuzzy text queryprotected List<AbstractOpenSearchQueryBuilder.ValueGroup> Fields that need to match all valuesprotected StringText queryFields inherited from interface org.opensearch.index.query.Rewriteable
MAX_REWRITE_ROUNDSFields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionAbstractOpenSearchQueryBuilder(T query) Creates a new OpenSearch query based on the raw query. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidStoresfieldValueas a search term on thefieldNamefield.protected voidStoresfieldValueas a search term on thefieldNamefield.protected voidandDateGreaterThan(String fieldName, String date) protected voidandDateLessThan(String fieldName, String date) protected voidStoresfieldValueas a search term on thefieldNamefield.protected voidandWildcard(String fieldName, String fieldValue) StoresfieldValueas a wildcard term on thefieldNamefield.protected voidandWildcardNot(String fieldName, String fieldValue) StoresfieldValueas a wildcard term on thefieldNamefield.floatboost()org.opensearch.index.query.QueryBuilderboost(float boost) abstract voidbuildQuery(T query) org.opensearch.index.query.QueryBuilderfilter(org.opensearch.index.query.QueryBuilder filter) getName()getQuery()Returns the original search query.booleanorg.opensearch.index.query.QueryBuilderorg.opensearch.index.query.QueryBuilderrewrite(org.opensearch.index.query.QueryRewriteContext queryShardContext) org.apache.lucene.search.QuerytoQuery(org.opensearch.index.query.QueryShardContext context) org.opensearch.core.xcontent.XContentBuildertoXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) voidwriteTo(org.opensearch.core.common.io.stream.StreamOutput out) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensearch.index.query.QueryBuilder
supportsIntraSegmentSearch, visit
-
Field Details
-
groups
Fields that need to match all values -
filter
Filter expression -
text
Text query -
additionalMultiQueryFields
-
fuzzy
protected boolean fuzzyFuzzy text query
-
-
Constructor Details
-
AbstractOpenSearchQueryBuilder
Creates a new OpenSearch query based on the raw query.- Parameters:
query- the search query
-
-
Method Details
-
getQuery
Returns the original search query.- Returns:
- the search query
-
buildQuery
-
and
StoresfieldValueas a search term on thefieldNamefield.- Parameters:
fieldName- the field namefieldValues- the field value
-
andNot
StoresfieldValueas a search term on thefieldNamefield.- Parameters:
fieldName- the field namefieldValues- the field value
-
andWildcard
StoresfieldValueas a wildcard term on thefieldNamefield.- Parameters:
fieldName- the field namefieldValue- the field value
-
andWildcardNot
StoresfieldValueas a wildcard term on thefieldNamefield.- Parameters:
fieldName- the field namefieldValue- the field value
-
and
StoresfieldValueas a search term on thefieldNamefield.- Parameters:
fieldName- the field namestartDate- the start dateendDate- the end date
-
andDateGreaterThan
-
andDateLessThan
-
toXContent
public org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.opensearch.core.xcontent.ToXContent- Throws:
IOException
-
toQuery
public org.apache.lucene.search.Query toQuery(org.opensearch.index.query.QueryShardContext context) throws IOException - Specified by:
toQueryin interfaceorg.opensearch.index.query.QueryBuilder- Throws:
IOException
-
queryName
- Specified by:
queryNamein interfaceorg.opensearch.index.query.QueryBuilder
-
queryName
- Specified by:
queryNamein interfaceorg.opensearch.index.query.QueryBuilder
-
boost
public float boost()- Specified by:
boostin interfaceorg.opensearch.index.query.QueryBuilder
-
boost
public org.opensearch.index.query.QueryBuilder boost(float boost) - Specified by:
boostin interfaceorg.opensearch.index.query.QueryBuilder
-
filter
public org.opensearch.index.query.QueryBuilder filter(org.opensearch.index.query.QueryBuilder filter) - Specified by:
filterin interfaceorg.opensearch.index.query.QueryBuilder
-
getName
- Specified by:
getNamein interfaceorg.opensearch.index.query.QueryBuilder
-
getWriteableName
- Specified by:
getWriteableNamein interfaceorg.opensearch.core.common.io.stream.NamedWriteable
-
writeTo
- Specified by:
writeToin interfaceorg.opensearch.core.common.io.stream.Writeable- Throws:
IOException
-
rewrite
public org.opensearch.index.query.QueryBuilder rewrite(org.opensearch.index.query.QueryRewriteContext queryShardContext) throws IOException - Specified by:
rewritein interfaceorg.opensearch.index.query.QueryBuilder- Specified by:
rewritein interfaceorg.opensearch.index.query.Rewriteable<T extends SearchQuery>- Throws:
IOException
-
isFragment
public boolean isFragment()- Specified by:
isFragmentin interfaceorg.opensearch.core.xcontent.ToXContent- Specified by:
isFragmentin interfaceorg.opensearch.core.xcontent.ToXContentObject
-