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
Modifier and TypeFieldDescriptionprotected String
The language.protected boolean
true
if 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
ConstructorDescriptionAbstractTextQuery
(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 void
checkStringValue
(String value) Ensure that the string value is valid (i.e.boolean
static String
escapeStringValue
(String value, Query.Operator operator) Escape from a string value the characters that can modify the query fieldGet the language.int
hashCode()
Methods inherited from class org.ametys.cms.search.query.AbstractOperatorQuery
getFieldName, getOperator, getValue, rewrite, valueForQuery
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ametys.cms.search.query.Query
buildAsJson, toString
-
Field Details
-
_language
The language. -
_valueAlreadyEscaped
true
if 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:Query
Build the solr query string representing the Query object.- Specified by:
build
in interfaceQuery
- Overrides:
build
in 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:
hashCode
in classAbstractOperatorQuery<String>
-
equals
- Overrides:
equals
in 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.
-