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 static Pattern |
FULLTEXT_ESCAPE_CHARS
Escape '{', '}', ':' and '!' characters to prevent the user from changing the query field.
|
protected static String |
FULLTEXT_ESCAPE_CHARS_REPLACEMENT
The replacement.
|
_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,
String value)
Build a string query.
|
StringQuery(String fieldPath,
String value,
String language)
Build a string query.
|
Modifier and Type | Method and Description |
---|---|
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.
|
static String |
escapeStringValue(String value)
Escape from a string value the characters that can modify the query field (':', '{' and '}').
|
String |
getLanguage()
Get the language.
|
Query.Operator |
getOperator()
Get the operator.
|
String |
getValue()
Get the value.
|
getFieldPath
protected static final Pattern FULLTEXT_ESCAPE_CHARS
protected static final String FULLTEXT_ESCAPE_CHARS_REPLACEMENT
protected Query.Operator _operator
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 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 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)
value
- the string value.