Package org.ametys.cms.search.query
Class AbstractTextQuery
java.lang.Object
org.ametys.cms.search.query.AbstractOperatorQuery<String>
org.ametys.cms.search.query.AbstractTextQuery
- Direct Known Subclasses:
RichTextQuery,StringQuery
Represents a
Query testing a text field.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.cms.search.query.Query
Query.LogicalOperator, Query.Operator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe language.protected booleantrueif the value is already escaped and there is no need to escape again the value duringthe build of the query.Fields inherited from interface org.ametys.cms.search.query.Query
BOOL_FILTER, BOOL_MUST, BOOL_MUST_NOT, BOOL_SHOULD -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTextQuery(String fieldPath) Build a AbstractTextQuery testing the existence of the field.AbstractTextQuery(String fieldPath, String value) Build a text query.AbstractTextQuery(String fieldPath, String value, String language) Build a text query.AbstractTextQuery(String fieldPath, Query.Operator op, String value, String language) Build a text query.AbstractTextQuery(String fieldPath, Query.Operator op, String value, String language, boolean alreadyEscaped) Build a text query. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the solr query string representing the Query object.static voidcheckStringValue(String value) Ensure that the string value is valid (i.e.booleanstatic StringescapeStringValue(String value, Query.Operator operator) Escape from a string value the characters that can modify the query fieldGet the language.inthashCode()Methods inherited from class org.ametys.cms.search.query.AbstractOperatorQuery
getFieldName, getOperator, getValue, rewrite, valueForQueryMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.cms.search.query.Query
buildAsJson, toString
-
Field Details
-
_language
The language. -
_valueAlreadyEscaped
trueif the value is already escaped and there is no need to escape again the value duringthe build of the query.
-
-
Constructor Details
-
AbstractTextQuery
Build a AbstractTextQuery testing the existence of the field.- Parameters:
fieldPath- the field path
-
AbstractTextQuery
Build a text query.- Parameters:
fieldPath- the field's pathvalue- the value.
-
AbstractTextQuery
Build a text query.- Parameters:
fieldPath- the field's pathvalue- the value.language- the query language (can be null).
-
AbstractTextQuery
Build a text query.- Parameters:
fieldPath- the field's pathop- the operator.value- the value.language- the query language (can be null).
-
AbstractTextQuery
public AbstractTextQuery(String fieldPath, Query.Operator op, String value, String language, boolean alreadyEscaped) Build a text query.- Parameters:
fieldPath- the field's pathop- the operator.value- the value.language- the query language (can be null).alreadyEscaped- true if the value is already escaped and there is no need to escape again the value duringthe build of the query.
-
-
Method Details
-
getLanguage
Get the language.- Returns:
- the language.
-
build
Description copied from interface:QueryBuild the solr query string representing the Query object.- Specified by:
buildin interfaceQuery- Overrides:
buildin classAbstractOperatorQuery<String>- Returns:
- the solr query string representing the Query object.
- Throws:
QuerySyntaxException- if the query can't be built because of a syntax error.
-
hashCode
- Overrides:
hashCodein classAbstractOperatorQuery<String>
-
equals
- Overrides:
equalsin classAbstractOperatorQuery<String>
-
checkStringValue
Ensure that the string value is valid (i.e. the parentheses are balanced), and throw an exception if it isn't.- Parameters:
value- the string value to check.- Throws:
QuerySyntaxException- if the value is invalid.
-
escapeStringValue
Escape from a string value the characters that can modify the query field- Parameters:
value- the string value.operator- the operator- Returns:
- the escaped value.
-