Package org.ametys.cms.search.query
Class NotQuery
java.lang.Object
org.ametys.cms.search.query.AbstractWrapperQuery
org.ametys.cms.search.query.NotQuery
- All Implemented Interfaces:
Query
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.cms.search.query.Query
Query.LogicalOperator, Query.Operator -
Field Summary
FieldsFields inherited from interface org.ametys.cms.search.query.Query
BOOL_FILTER, BOOL_MUST, BOOL_MUST_NOT, BOOL_SHOULD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuilderappendNegation(StringBuilder query) Appends a negation to the query being built.build()Build the solr query string representing the Query object.Build the solr query representing the Query object.
The return type may be either String or Map<String, Object> following the Solr JSON Query DSL.rewrite()Rewrite this Query to allow further optimisations.toString(int indent) Gets a representation of thisQuery, for pretty-printing for logging and debugging purposesMethods inherited from class org.ametys.cms.search.query.AbstractWrapperQuery
equals, getSubQuery, hashCode
-
Field Details
-
NEGATION_QUERY_PREFIX
The prefix for making a query negative.- See Also:
-
-
Constructor Details
-
NotQuery
Build a NotQuery object.- Parameters:
query- the negated query.
-
-
Method Details
-
appendNegation
Appends a negation to the query being built.
This method just doessb.append("*:* -");- Parameters:
query- The query builder- Returns:
- The given query builder
-
build
Description copied from interface:QueryBuild the solr query string representing the Query object.- Returns:
- the solr query string representing the Query object.
- Throws:
QuerySyntaxException- if the query can't be built because of a syntax error.
-
buildAsJson
Description copied from interface:QueryBuild the solr query representing the Query object.
The return type may be either String or Map<String, Object> following the Solr JSON Query DSL.- Returns:
- the solr query representing the Query object. Can be empty in case of empty query.
- Throws:
QuerySyntaxException- if the query can't be built because of a syntax error.
-
rewrite
Description copied from interface:QueryRewrite this Query to allow further optimisations.- Returns:
- a rewritten Query, sementically identical. Can be empty in case of empty query
-
toString
Description copied from interface:QueryGets a representation of thisQuery, for pretty-printing for logging and debugging purposes- Parameters:
indent- The current indentation. Base indentation is 2 (for printing a sub-level)- Returns:
- a representation of this
Query
-