public class StringQuery extends AbstractFieldQuery
Query
testing a string field.Query.LogicalOperator, Query.Operator
Modifier and Type | Field and Description |
---|---|
protected String |
_language
The language.
|
protected Query.Operator |
_operator
The operator.
|
protected String |
_value
The value to test.
|
protected boolean |
_valueAlreadyEscaped
true if the value is already escaped and there is no need to escape again the value during the build of the query . |
_fieldPath
Constructor and Description |
---|
StringQuery(String fieldPath)
Build a StringQuery testing the existence of the field.
|
StringQuery(String fieldPath,
Query.Operator op,
String value,
String language)
Build a string query.
|
StringQuery(String fieldPath,
Query.Operator op,
String value,
String language,
boolean alreadyEscaped)
Build a string query.
|
StringQuery(String fieldPath,
String value)
Build a string query.
|
StringQuery(String fieldPath,
String value,
String language)
Build a string query.
|
Modifier and Type | Method and Description |
---|---|
private static String |
_escapeQueryCharsExceptStarsAndWhitespaces(String s) |
String |
build()
Build the solr query string representing the Query object.
|
static void |
checkStringValue(String value)
Ensure that the string value is valid (i.e.
|
boolean |
equals(Object obj) |
static String |
escapeStringValue(String value,
Query.Operator operator)
Escape from a string value the characters that can modify the query field
|
String |
getLanguage()
Get the language.
|
Query.Operator |
getOperator()
Get the operator.
|
String |
getValue()
Get the value.
|
int |
hashCode() |
getFieldPath
protected Query.Operator _operator
protected boolean _valueAlreadyEscaped
true
if the value is already escaped and there is no need to escape again the value during the build of the query
.public StringQuery(String fieldPath)
fieldPath
- the field pathpublic StringQuery(String fieldPath, String value)
fieldPath
- the field's pathvalue
- the value.public StringQuery(String fieldPath, String value, String language)
fieldPath
- the field's pathvalue
- the value.language
- the query language (can be null).public StringQuery(String fieldPath, Query.Operator op, String value, String language)
fieldPath
- the field's pathop
- the operator.value
- the value.language
- the query language (can be null).public StringQuery(String fieldPath, Query.Operator op, String value, String language, boolean alreadyEscaped)
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 during the build of the query
.public Query.Operator getOperator()
public String getLanguage()
public String build() throws QuerySyntaxException
Query
QuerySyntaxException
- if the query can't be built because of a syntax error.public int hashCode()
hashCode
in class AbstractFieldQuery
public boolean equals(Object obj)
equals
in class AbstractFieldQuery
public static void checkStringValue(String value) throws QuerySyntaxException
value
- the string value to check.QuerySyntaxException
- if the value is invalid.public static String escapeStringValue(String value, Query.Operator operator)
value
- the string value.operator
- the operatorprivate static String _escapeQueryCharsExceptStarsAndWhitespaces(String s)