Class AbstractElasticsearchQueryBuilder<T extends SearchQuery>
java.lang.Object
org.opencastproject.elasticsearch.impl.AbstractElasticsearchQueryBuilder<T>
- All Implemented Interfaces:
org.elasticsearch.common.io.stream.NamedWriteable,org.elasticsearch.common.io.stream.Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentObject,org.elasticsearch.index.query.QueryBuilder,org.elasticsearch.index.query.Rewriteable<org.elasticsearch.index.query.QueryBuilder>
- Direct Known Subclasses:
EventQueryBuilder,SeriesQueryBuilder,ThemeQueryBuilder
public abstract class AbstractElasticsearchQueryBuilder<T extends SearchQuery>
extends Object
implements org.elasticsearch.index.query.QueryBuilder
Opencast implementation of the elastic search query builder.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classUtility class to hold date range specifications and turn them into elastic search 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.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
org.elasticsearch.common.io.stream.Writeable.Reader<V>, org.elasticsearch.common.io.stream.Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringFilter expressionprotected booleanFuzzy text queryprotected List<AbstractElasticsearchQueryBuilder.ValueGroup> Fields that need to match all valuesprotected StringText queryFields inherited from interface org.elasticsearch.index.query.Rewriteable
MAX_REWRITE_ROUNDSFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new elastic search query based on the raw query. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidStoresfieldValueas a search term on thefieldNamefield.protected voidStoresfieldValueas a search term on thefieldNamefield.floatboost()org.elasticsearch.index.query.QueryBuilderboost(float boost) abstract voidbuildQuery(T query) getName()getQuery()Returns the original search query.booleanorg.elasticsearch.index.query.QueryBuilderorg.elasticsearch.index.query.QueryBuilderrewrite(org.elasticsearch.index.query.QueryRewriteContext queryShardContext) org.apache.lucene.search.QuerytoQuery(org.elasticsearch.index.query.QueryShardContext context) org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) voidwriteTo(org.elasticsearch.common.io.stream.StreamOutput out)
-
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
-
AbstractElasticsearchQueryBuilder
Creates a new elastic search 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
-
and
StoresfieldValueas a search term on thefieldNamefield.- Parameters:
fieldName- the field namestartDate- the start dateendDate- the end date
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
IOException
-
toQuery
public org.apache.lucene.search.Query toQuery(org.elasticsearch.index.query.QueryShardContext context) throws IOException - Specified by:
toQueryin interfaceorg.elasticsearch.index.query.QueryBuilder- Throws:
IOException
-
queryName
- Specified by:
queryNamein interfaceorg.elasticsearch.index.query.QueryBuilder
-
queryName
- Specified by:
queryNamein interfaceorg.elasticsearch.index.query.QueryBuilder
-
boost
public float boost()- Specified by:
boostin interfaceorg.elasticsearch.index.query.QueryBuilder
-
boost
public org.elasticsearch.index.query.QueryBuilder boost(float boost) - Specified by:
boostin interfaceorg.elasticsearch.index.query.QueryBuilder
-
getName
- Specified by:
getNamein interfaceorg.elasticsearch.index.query.QueryBuilder
-
getWriteableName
- Specified by:
getWriteableNamein interfaceorg.elasticsearch.common.io.stream.NamedWriteable
-
writeTo
- Specified by:
writeToin interfaceorg.elasticsearch.common.io.stream.Writeable- Throws:
IOException
-
rewrite
public org.elasticsearch.index.query.QueryBuilder rewrite(org.elasticsearch.index.query.QueryRewriteContext queryShardContext) throws IOException - Specified by:
rewritein interfaceorg.elasticsearch.index.query.QueryBuilder- Specified by:
rewritein interfaceorg.elasticsearch.index.query.Rewriteable<T extends SearchQuery>- Throws:
IOException
-
isFragment
public boolean isFragment()- Specified by:
isFragmentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Specified by:
isFragmentin interfaceorg.elasticsearch.common.xcontent.ToXContentObject
-