Class TextQuery
- java.lang.Object
-
public class TextQuery extends ChangableValueQuery
A query allowing search on a text string. The flexibility provided by this query makes it an ideal wrapper for unstructured query terms (such as come from a user-facing search bar).TextQuery
supports several options for controlling how this text is used, most prominently which fields should be searched against and if/how proximity searching should be performed. See individual options for more details.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TYPE
-
Constructor Summary
Constructors Constructor Description TextQuery(java.util.List<KeyAndBoost> fields, java.util.List<KeyAndBoost> phraseFields, java.lang.Integer phraseSlop, java.lang.String minimumShouldMatch, java.util.List<MinimumMatch> minimumMatch, java.lang.Integer queryPhraseSlop, java.lang.String value)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TextQuery
clone()
java.util.List<KeyAndBoost>
getFields()
java.util.List<MinimumMatch>
getMinimumMatch()
java.lang.String
getMinimumShouldMatch()
Deprecated.java.util.List<KeyAndBoost>
getPhraseFields()
java.lang.Integer
getPhraseSlop()
java.lang.Integer
getQueryPhraseSlop()
java.lang.String
getValue()
void
setFields(java.util.List<KeyAndBoost> fields)
void
setMinimumMatch(java.util.List<MinimumMatch> minimumMatch)
void
setValue(java.lang.String value)
-
Methods inherited from class com.lucidworks.search.dsl.request.query.ChangableValueQuery
isEmptyQuery
-
Methods inherited from class com.lucidworks.search.dsl.request.query.AbstractLeafQuery
getChildQueries, removeChildQuery, replaceChildQuery
-
Methods inherited from class com.lucidworks.search.dsl.request.DslCloneable
clone, deepClone
-
-
-
-
Field Detail
-
TYPE
public static final java.lang.String TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TextQuery
public TextQuery(java.util.List<KeyAndBoost> fields, java.util.List<KeyAndBoost> phraseFields, java.lang.Integer phraseSlop, java.lang.String minimumShouldMatch, java.util.List<MinimumMatch> minimumMatch, java.lang.Integer queryPhraseSlop, java.lang.String value)
-
-
Method Detail
-
getFields
public java.util.List<KeyAndBoost> getFields()
- Returns:
- the fields to search for the supplied text, along with per-field boosts indicating the relative importance of each field.
-
getPhraseFields
public java.util.List<KeyAndBoost> getPhraseFields()
- Returns:
- the fields to phrase-search for the supplied text, along with per-field boosts indicating the relative importance of each field.
-
getMinimumShouldMatch
@Deprecated public java.lang.String getMinimumShouldMatch()
Deprecated.- Returns:
- an expression signifying how many query terms in
getValue()
must be present for a document to be considered a match.May be specified as a positive integer (indicating the number of terms in absolute terms), a negative integer (indicating the number of terms relative to the total), a positive percentage (indicating the percent of query terms that must be present), or a negative percentage (indicting the percent of query terms that may be absent).
If not specified, assumed default is "1"
-
getMinimumMatch
public java.util.List<MinimumMatch> getMinimumMatch()
-
setMinimumMatch
public void setMinimumMatch(java.util.List<MinimumMatch> minimumMatch)
-
getPhraseSlop
public java.lang.Integer getPhraseSlop()
- Returns:
- the "slop" used when detecting phrase matches for the entire
value
. Slop is a measure of how flexible phrase searches should be in matching documents - each unit of slop represents a movement of one token relative to another that is needed for a phrase query to match text in an underlying document. The higher the number, the more forgiving phrase searches are.
-
getQueryPhraseSlop
public java.lang.Integer getQueryPhraseSlop()
- Returns:
- the "slop" used when evaluating phrase queries explicitly included in the provided
value
. (As opposed tophraseSlop
which designates the slop used for matching the complete query string). - See Also:
getPhraseSlop()
-
setValue
public void setValue(java.lang.String value)
- Specified by:
setValue
in classChangableValueQuery
-
getValue
public java.lang.String getValue()
- Specified by:
getValue
in classChangableValueQuery
- Returns:
- a text string containing the query terms to search.
-
setFields
public void setFields(java.util.List<KeyAndBoost> fields)
-
clone
public TextQuery clone()
- Specified by:
clone
in classChangableValueQuery
-
-