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).TextQuerysupports 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.StringTYPE
-
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 TextQueryclone()java.util.List<KeyAndBoost>getFields()java.util.List<MinimumMatch>getMinimumMatch()java.lang.StringgetMinimumShouldMatch()Deprecated.java.util.List<KeyAndBoost>getPhraseFields()java.lang.IntegergetPhraseSlop()java.lang.IntegergetQueryPhraseSlop()java.lang.StringgetValue()voidsetFields(java.util.List<KeyAndBoost> fields)voidsetMinimumMatch(java.util.List<MinimumMatch> minimumMatch)voidsetValue(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 tophraseSlopwhich designates the slop used for matching the complete query string). - See Also:
getPhraseSlop()
-
setValue
public void setValue(java.lang.String value)
- Specified by:
setValuein classChangableValueQuery
-
getValue
public java.lang.String getValue()
- Specified by:
getValuein 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:
clonein classChangableValueQuery
-
-