Package org.apache.solr.client.solrj

## Class SolrQuery

- java.lang.Object
- - org.apache.solr.common.params.SolrParams
  - - org.apache.solr.common.params.ModifiableSolrParams
    - - org.apache.solr.client.solrj.SolrQuery

All Implemented Interfaces:
  `Serializable`, `Iterable<Map.Entry<String,​String[]>>`, `MapSerializable`, `MapWriter`, `NavigableObject`

    public class SolrQuery
    extends ModifiableSolrParams

This is an augmented SolrParams with get/set/add fields for common fields used in the Standard and Dismax request handlers

Since:
  solr 1.3
See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `SolrQuery.ORDER`
`static class` `SolrQuery.SortClause` A single sort clause, encapsulating what to sort and the sort order.

### Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter

`MapWriter.EntryWriter`

### Field Summary

Fields
`static String` `DOCID`

### Constructor Summary

Constructors
`SolrQuery()`
`SolrQuery​(String q)` Create a new SolrQuery
`SolrQuery​(String k, String v, String... params)`

### Method Summary

All Methods Instance Methods Concrete Methods
`SolrQuery` `addDateRangeFacet​(String field, Date start, Date end, String gap)` Add a numeric range facet.
`SolrQuery` `addFacetField​(String... fields)` Add field(s) for facet computation.
`SolrQuery` `addFacetPivotField​(String... fields)` Add field(s) for pivot computation.
`SolrQuery` `addFacetQuery​(String f)` add a faceting query
`SolrQuery` `addField​(String field)`
`SolrQuery` `addFilterQuery​(String... fq)`
`void` `addGetFieldStatistics​(String... field)`
`SolrQuery` `addHighlightField​(String f)` add highlight field
`SolrQuery` `addIntervalFacets​(String field, String[] intervals)` Add Interval Faceting on a field.
`SolrQuery` `addMoreLikeThisField​(String field)` Add field for MoreLikeThis.
`SolrQuery` `addNumericRangeFacet​(String field, Number start, Number end, Number gap)` Add a numeric range facet.
`SolrQuery` `addOrUpdateSort​(String field, SolrQuery.ORDER order)` Updates or adds a single sort clause to the query.
`SolrQuery` `addOrUpdateSort​(SolrQuery.SortClause sortClause)` Updates or adds a single sort field specification to the current sort information.
`SolrQuery` `addSort​(String field, SolrQuery.ORDER order)` Adds a single sort clause to the end of the current sort information.
`SolrQuery` `addSort​(SolrQuery.SortClause sortClause)` Adds a single sort clause to the end of the query.
`void` `addStatsFieldCalcDistinct​(String field, boolean calcDistinct)`
`void` `addStatsFieldFacets​(String field, String... facets)`
`SolrQuery` `addTermsField​(String field)`
`SolrQuery` `clearSorts()` Clears current sort information.
`SolrQuery` `getCopy()` get a deep copy of this object *
`String[]` `getFacetFields()` get the facet fields
`int` `getFacetLimit()` get current facet limit
`int` `getFacetMinCount()` get facet minimum count
`String[]` `getFacetQuery()` get facet queries
`String` `getFacetSortString()` get facet sort
`String` `getFields()`
`String[]` `getFilterQueries()`
`boolean` `getHighlight()`
`String[]` `getHighlightFields()` get list of highlighted fields
`int` `getHighlightFragsize()`
`boolean` `getHighlightRequireFieldMatch()`
`String` `getHighlightSimplePost()`
`String` `getHighlightSimplePre()`
`int` `getHighlightSnippets()`
`boolean` `getMoreLikeThis()`
`boolean` `getMoreLikeThisBoost()` Gets if the query will be boosted by the interesting term relevance.
`int` `getMoreLikeThisCount()` Gets the number of similar documents to return for each result.
`String[]` `getMoreLikeThisFields()`
`int` `getMoreLikeThisMaxQueryTerms()` Gets the maximum number of query terms that will be included in any generated query.
`int` `getMoreLikeThisMaxTokensParsed()` Gets the maximum number of tokens to parse in each example doc field that is not stored with TermVector support.
`int` `getMoreLikeThisMaxWordLen()` Gets the maximum word length above which words will be ignored.
`int` `getMoreLikeThisMinDocFreq()` Gets the frequency at which words will be ignored which do not occur in at least this many docs.
`int` `getMoreLikeThisMinTermFreq()` Gets the frequency below which terms will be ignored in the source doc
`int` `getMoreLikeThisMinWordLen()` Gets the minimum word length below which words will be ignored.
`String` `getMoreLikeThisQF()` Gets the query fields and their boosts.
`String` `getQuery()`
`String` `getRequestHandler()`
`Integer` `getRows()`
`String` `getSortField()` Gets the raw sort field, as it will be sent to Solr.
`List<SolrQuery.SortClause>` `getSorts()` Gets an a list of current sort clauses.
`Integer` `getStart()`
`boolean` `getTerms()`
`String[]` `getTermsFields()`
`int` `getTermsLimit()`
`String` `getTermsLower()`
`boolean` `getTermsLowerInclusive()`
`int` `getTermsMaxCount()`
`int` `getTermsMinCount()`
`String` `getTermsPrefix()`
`boolean` `getTermsRaw()`
`String` `getTermsRegex()`
`String[]` `getTermsRegexFlags()`
`String` `getTermsSortString()`
`String` `getTermsUpper()`
`boolean` `getTermsUpperInclusive()`
`Integer` `getTimeAllowed()` Get the maximum time allowed for this query.
`boolean` `removeFacetField​(String name)` remove a facet field
`boolean` `removeFacetQuery​(String q)` remove a facet query
`boolean` `removeFilterQuery​(String fq)`
`boolean` `removeHighlightField​(String f)` remove a field for highlighting
`String[]` `removeIntervalFacets​(String field)` Remove all Interval Facets on a field
`SolrQuery` `removeSort​(String itemName)` Removes a single sort field from the current sort information.
`SolrQuery` `removeSort​(SolrQuery.SortClause sortClause)` Removes a single sort field from the current sort information.
`void` `setDistrib​(boolean val)`
`SolrQuery` `setFacet​(boolean b)` enable/disable faceting.
`SolrQuery` `setFacetLimit​(int lim)` set the facet limit
`SolrQuery` `setFacetMinCount​(int cnt)` set facet minimum count
`SolrQuery` `setFacetMissing​(Boolean v)` Sets facet missing boolean flag
`SolrQuery` `setFacetPrefix​(String prefix)`
`SolrQuery` `setFacetPrefix​(String field, String prefix)`
`SolrQuery` `setFacetSort​(String sort)` set facet sort
`SolrQuery` `setFields​(String... fields)`
`SolrQuery` `setFilterQueries​(String... fq)`
`void` `setGetFieldStatistics​(boolean v)`
`void` `setGetFieldStatistics​(String field)`
`SolrQuery` `setHighlight​(boolean b)`
`SolrQuery` `setHighlightFragsize​(int num)`
`SolrQuery` `setHighlightRequireFieldMatch​(boolean flag)`
`SolrQuery` `setHighlightSimplePost​(String f)`
`SolrQuery` `setHighlightSimplePre​(String f)`
`SolrQuery` `setHighlightSnippets​(int num)`
`SolrQuery` `setIncludeScore​(boolean includeScore)`
`SolrQuery` `setMoreLikeThis​(boolean b)` Enable/Disable MoreLikeThis.
`SolrQuery` `setMoreLikeThisBoost​(boolean b)` Sets if the query will be boosted by the interesting term relevance.
`SolrQuery` `setMoreLikeThisCount​(int count)` Sets the number of similar documents to return for each result.
`SolrQuery` `setMoreLikeThisFields​(String... fields)`
`SolrQuery` `setMoreLikeThisMaxQueryTerms​(int maxqt)` Sets the maximum number of query terms that will be included in any generated query.
`SolrQuery` `setMoreLikeThisMaxTokensParsed​(int maxntp)` Sets the maximum number of tokens to parse in each example doc field that is not stored with TermVector support.
`SolrQuery` `setMoreLikeThisMaxWordLen​(int maxwl)` Sets the maximum word length above which words will be ignored.
`SolrQuery` `setMoreLikeThisMinDocFreq​(int mindf)` Sets the frequency at which words will be ignored which do not occur in at least this many docs.
`SolrQuery` `setMoreLikeThisMinTermFreq​(int mintf)` Sets the frequency below which terms will be ignored in the source doc
`SolrQuery` `setMoreLikeThisMinWordLen​(int minwl)` Sets the minimum word length below which words will be ignored.
`SolrQuery` `setMoreLikeThisQF​(String qf)` Sets the query fields and their boosts using the same format as that used in DisMaxQParserPlugin.
`SolrQuery` `setParam​(String name, boolean value)`
`SolrQuery` `setParam​(String name, String... values)`
`SolrQuery` `setQuery​(String query)`
`SolrQuery` `setRequestHandler​(String qt)` The Request Handler to use (see the solrconfig.xml), which is stored in the "qt" parameter.
`SolrQuery` `setRows​(Integer rows)`
`SolrQuery` `setShowDebugInfo​(boolean showDebugInfo)`
`SolrQuery` `setSort​(String field, SolrQuery.ORDER order)` Replaces the current sort information with a single sort clause
`SolrQuery` `setSort​(SolrQuery.SortClause sortClause)` Replaces the current sort information with a single sort clause
`SolrQuery` `setSorts​(List<SolrQuery.SortClause> value)` Replaces the current sort information.
`SolrQuery` `setStart​(Integer start)`
`SolrQuery` `setTerms​(boolean b)` enable/disable terms.
`SolrQuery` `setTermsLimit​(int limit)`
`SolrQuery` `setTermsLower​(String lower)`
`SolrQuery` `setTermsLowerInclusive​(boolean b)`
`SolrQuery` `setTermsMaxCount​(int cnt)`
`SolrQuery` `setTermsMinCount​(int cnt)`
`SolrQuery` `setTermsPrefix​(String prefix)`
`SolrQuery` `setTermsRaw​(boolean b)`
`SolrQuery` `setTermsRegex​(String regex)`
`SolrQuery` `setTermsRegexFlag​(String flag)`
`SolrQuery` `setTermsSortString​(String type)`
`SolrQuery` `setTermsUpper​(String upper)`
`SolrQuery` `setTermsUpperInclusive​(boolean b)`
`SolrQuery` `setTimeAllowed​(Integer milliseconds)` Set the maximum time allowed for this query.

### Methods inherited from class org.apache.solr.common.params.ModifiableSolrParams

`add, add, clear, get, getMap, getParameterNames, getParameterNamesIterator, getParams, iterator, of, remove, remove, set, set, set, setNonNull, size`

### Methods inherited from class org.apache.solr.common.params.SolrParams

`fpname, get, getAll, getAll, getBool, getBool, getDouble, getDouble, getFieldBool, getFieldBool, getFieldDouble, getFieldDouble, getFieldFloat, getFieldFloat, getFieldInt, getFieldInt, getFieldParam, getFieldParam, getFieldParams, getFloat, getFloat, getInt, getInt, getLong, getLong, getPrimitiveBool, getPrimitiveFieldBool, getPrimitiveFieldFloat, getPrimitiveInt, required, stream, toFilteredSolrParams, toLocalParamsString, toMap, toMultiMap, toNamedList, toQueryString, toSolrParams, toString, wrapAppended, wrapDefaults, writeMap`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Methods inherited from interface org.apache.solr.common.MapWriter

`jsonStr, toMap`

### Methods inherited from interface org.apache.solr.common.NavigableObject

`_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size`

### Field Detail

#### DOCID

    public static final String DOCID

See Also:
  Constant Field Values

### Constructor Detail

#### SolrQuery

    public SolrQuery()

#### SolrQuery

    public SolrQuery​(String q)

Create a new SolrQuery

Parameters:
  `q` - query string

#### SolrQuery

    public SolrQuery​(String k,
                     String v,
                     String... params)

### Method Detail

#### setTerms

    public SolrQuery setTerms​(boolean b)

enable/disable terms.

Parameters:
  `b` - flag to indicate terms should be enabled.
  if b==false, removes all other terms parameters
Returns:
  Current reference (this)

#### getTerms

    public boolean getTerms()

#### addTermsField

    public SolrQuery addTermsField​(String field)

#### getTermsFields

    public String[] getTermsFields()

#### setTermsLower

    public SolrQuery setTermsLower​(String lower)

#### getTermsLower

    public String getTermsLower()

#### setTermsUpper

    public SolrQuery setTermsUpper​(String upper)

#### getTermsUpper

    public String getTermsUpper()

#### setTermsUpperInclusive

    public SolrQuery setTermsUpperInclusive​(boolean b)

#### getTermsUpperInclusive

    public boolean getTermsUpperInclusive()

#### setTermsLowerInclusive

    public SolrQuery setTermsLowerInclusive​(boolean b)

#### getTermsLowerInclusive

    public boolean getTermsLowerInclusive()

#### setTermsLimit

    public SolrQuery setTermsLimit​(int limit)

#### getTermsLimit

    public int getTermsLimit()

#### setTermsMinCount

    public SolrQuery setTermsMinCount​(int cnt)

#### getTermsMinCount

    public int getTermsMinCount()

#### setTermsMaxCount

    public SolrQuery setTermsMaxCount​(int cnt)

#### getTermsMaxCount

    public int getTermsMaxCount()

#### setTermsPrefix

    public SolrQuery setTermsPrefix​(String prefix)

#### getTermsPrefix

    public String getTermsPrefix()

#### setTermsRaw

    public SolrQuery setTermsRaw​(boolean b)

#### getTermsRaw

    public boolean getTermsRaw()

#### setTermsSortString

    public SolrQuery setTermsSortString​(String type)

#### getTermsSortString

    public String getTermsSortString()

#### setTermsRegex

    public SolrQuery setTermsRegex​(String regex)

#### getTermsRegex

    public String getTermsRegex()

#### setTermsRegexFlag

    public SolrQuery setTermsRegexFlag​(String flag)

#### getTermsRegexFlags

    public String[] getTermsRegexFlags()

#### addFacetField

    public SolrQuery addFacetField​(String... fields)

Add field(s) for facet computation.

Parameters:
  `fields` - Array of field names from the IndexSchema
Returns:
  this

#### addFacetPivotField

    public SolrQuery addFacetPivotField​(String... fields)

Add field(s) for pivot computation.

pivot fields are comma separated

Parameters:
  `fields` - Array of field names from the IndexSchema
Returns:
  this

#### addNumericRangeFacet

    public SolrQuery addNumericRangeFacet​(String field,
                                          Number start,
                                          Number end,
                                          Number gap)

Add a numeric range facet.

Parameters:
  `field` - The field
  `start` - The start of range
  `end` - The end of the range
  `gap` - The gap between each count
Returns:
  this

#### addDateRangeFacet

    public SolrQuery addDateRangeFacet​(String field,
                                       Date start,
                                       Date end,
                                       String gap)

Add a numeric range facet.

Parameters:
  `field` - The field
  `start` - The start of range
  `end` - The end of the range
  `gap` - The gap between each count
Returns:
  this

#### addIntervalFacets

    public SolrQuery addIntervalFacets​(String field,
                                       String[] intervals)

Add Interval Faceting on a field. All intervals for the same field should be included in the same call to this method. For syntax documentation see Solr wiki.
Key substitution, filter exclusions or other local params on the field are not supported when using this method, if this is needed, use the lower level `ModifiableSolrParams.add(java.lang.String, java.lang.String...)` method.
Key substitution IS supported on intervals when using this method.

Parameters:
  `field` - the field to add facet intervals. Must be an existing field and can't be null
  `intervals` - Intervals to be used for faceting. It can be an empty array, but it can't be `null`
Returns:
  this

#### removeIntervalFacets

    public String[] removeIntervalFacets​(String field)

Remove all Interval Facets on a field

Parameters:
  `field` - the field to remove from facet intervals
Returns:
  Array of current intervals for `field`

#### getFacetFields

    public String[] getFacetFields()

get the facet fields

Returns:
  string array of facet fields or null if not set/empty

#### removeFacetField

    public boolean removeFacetField​(String name)

remove a facet field

Parameters:
  `name` - Name of the facet field to be removed.
Returns:
  true, if the item was removed.
  false, if the facet field was null or did not exist.

#### setFacet

    public SolrQuery setFacet​(boolean b)

enable/disable faceting.

Parameters:
  `b` - flag to indicate faceting should be enabled.
  if b==false, removes all other faceting parameters
Returns:
  Current reference (this)

#### setFacetPrefix

    public SolrQuery setFacetPrefix​(String prefix)

#### setFacetPrefix

    public SolrQuery setFacetPrefix​(String field,
                                    String prefix)

#### addFacetQuery

    public SolrQuery addFacetQuery​(String f)

add a faceting query

Parameters:
  `f` - facet query

#### getFacetQuery

    public String[] getFacetQuery()

get facet queries

Returns:
  all facet queries or null if not set/empty

#### removeFacetQuery

    public boolean removeFacetQuery​(String q)

remove a facet query

Parameters:
  `q` - the facet query to remove
Returns:
  true if the facet query was removed false otherwise

#### setFacetLimit

    public SolrQuery setFacetLimit​(int lim)

set the facet limit

Parameters:
  `lim` - number facet items to return

#### getFacetLimit

    public int getFacetLimit()

get current facet limit

Returns:
  facet limit or default of 25

#### setFacetMinCount

    public SolrQuery setFacetMinCount​(int cnt)

set facet minimum count

Parameters:
  `cnt` - facets having less that cnt hits will be excluded from teh facet list

#### getFacetMinCount

    public int getFacetMinCount()

get facet minimum count

Returns:
  facet minimum count or default of 1

#### setFacetMissing

    public SolrQuery setFacetMissing​(Boolean v)

Sets facet missing boolean flag

Parameters:
  `v` - flag to indicate the field of `FacetParams.FACET_MISSING` .
Returns:
  this

#### getFacetSortString

    public String getFacetSortString()

get facet sort

Returns:
  facet sort or default of `FacetParams.FACET_SORT_COUNT`

#### setFacetSort

    public SolrQuery setFacetSort​(String sort)

set facet sort

Parameters:
  `sort` - sort facets
Returns:
  this

#### addHighlightField

    public SolrQuery addHighlightField​(String f)

add highlight field

Parameters:
  `f` - field to enable for highlighting

#### removeHighlightField

    public boolean removeHighlightField​(String f)

remove a field for highlighting

Parameters:
  `f` - field name to not highlight
Returns:
  true, if removed,
  false, otherwise

#### getHighlightFields

    public String[] getHighlightFields()

get list of highlighted fields

Returns:
  Array of highlight fields or null if not set/empty

#### setHighlightSnippets

    public SolrQuery setHighlightSnippets​(int num)

#### getHighlightSnippets

    public int getHighlightSnippets()

#### setHighlightFragsize

    public SolrQuery setHighlightFragsize​(int num)

#### getHighlightFragsize

    public int getHighlightFragsize()

#### setHighlightRequireFieldMatch

    public SolrQuery setHighlightRequireFieldMatch​(boolean flag)

#### getHighlightRequireFieldMatch

    public boolean getHighlightRequireFieldMatch()

#### setHighlightSimplePre

    public SolrQuery setHighlightSimplePre​(String f)

#### getHighlightSimplePre

    public String getHighlightSimplePre()

#### setHighlightSimplePost

    public SolrQuery setHighlightSimplePost​(String f)

#### getHighlightSimplePost

    public String getHighlightSimplePost()

#### getSortField

    public String getSortField()

Gets the raw sort field, as it will be sent to Solr.

The returned sort field will always contain a serialized version of the sort string built using `setSort(SortClause)`, `addSort(SortClause)`, `addOrUpdateSort(SortClause)`, `removeSort(SortClause)`, `clearSorts()` and `setSorts(List)`.

#### clearSorts

    public SolrQuery clearSorts()

Clears current sort information.

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### setSorts

    public SolrQuery setSorts​(List<SolrQuery.SortClause> value)

Replaces the current sort information.

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### getSorts

    public List<SolrQuery.SortClause> getSorts()

Gets an a list of current sort clauses.

Returns:
  an immutable list of current sort clauses
Since:
  4.2

#### setSort

    public SolrQuery setSort​(String field,
                             SolrQuery.ORDER order)

Replaces the current sort information with a single sort clause

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### setSort

    public SolrQuery setSort​(SolrQuery.SortClause sortClause)

Replaces the current sort information with a single sort clause

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### addSort

    public SolrQuery addSort​(String field,
                             SolrQuery.ORDER order)

Adds a single sort clause to the end of the current sort information.

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### addSort

    public SolrQuery addSort​(SolrQuery.SortClause sortClause)

Adds a single sort clause to the end of the query.

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### addOrUpdateSort

    public SolrQuery addOrUpdateSort​(String field,
                                     SolrQuery.ORDER order)

Updates or adds a single sort clause to the query. If the field is already used for sorting, the order of the existing field is modified; otherwise, it is added to the end.

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### addOrUpdateSort

    public SolrQuery addOrUpdateSort​(SolrQuery.SortClause sortClause)

Updates or adds a single sort field specification to the current sort information. If the sort field already exist in the sort information map, its position is unchanged and the sort order is set; if it does not exist, it is appended at the end with the specified order..

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### removeSort

    public SolrQuery removeSort​(SolrQuery.SortClause sortClause)

Removes a single sort field from the current sort information.

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### removeSort

    public SolrQuery removeSort​(String itemName)

Removes a single sort field from the current sort information.

Returns:
  the modified SolrQuery object, for easy chaining
Since:
  4.2

#### setGetFieldStatistics

    public void setGetFieldStatistics​(boolean v)

#### setGetFieldStatistics

    public void setGetFieldStatistics​(String field)

#### addGetFieldStatistics

    public void addGetFieldStatistics​(String... field)

#### addStatsFieldFacets

    public void addStatsFieldFacets​(String field,
                                    String... facets)

#### addStatsFieldCalcDistinct

    public void addStatsFieldCalcDistinct​(String field,
                                          boolean calcDistinct)

#### setFilterQueries

    public SolrQuery setFilterQueries​(String... fq)

#### addFilterQuery

    public SolrQuery addFilterQuery​(String... fq)

#### removeFilterQuery

    public boolean removeFilterQuery​(String fq)

#### getFilterQueries

    public String[] getFilterQueries()

#### getHighlight

    public boolean getHighlight()

#### setHighlight

    public SolrQuery setHighlight​(boolean b)

#### addMoreLikeThisField

    public SolrQuery addMoreLikeThisField​(String field)

Add field for MoreLikeThis. Automatically enables MoreLikeThis.

Parameters:
  `field` - the names of the field to be added
Returns:
  this

#### setMoreLikeThisFields

    public SolrQuery setMoreLikeThisFields​(String... fields)

#### getMoreLikeThisFields

    public String[] getMoreLikeThisFields()

Returns:
  an array with the fields used to compute similarity.

#### setMoreLikeThisMinTermFreq

    public SolrQuery setMoreLikeThisMinTermFreq​(int mintf)

Sets the frequency below which terms will be ignored in the source doc

Parameters:
  `mintf` - the minimum term frequency
Returns:
  this

#### getMoreLikeThisMinTermFreq

    public int getMoreLikeThisMinTermFreq()

Gets the frequency below which terms will be ignored in the source doc

#### setMoreLikeThisMinDocFreq

    public SolrQuery setMoreLikeThisMinDocFreq​(int mindf)

Sets the frequency at which words will be ignored which do not occur in at least this many docs.

Parameters:
  `mindf` - the minimum document frequency
Returns:
  this

#### getMoreLikeThisMinDocFreq

    public int getMoreLikeThisMinDocFreq()

Gets the frequency at which words will be ignored which do not occur in at least this many docs.

#### setMoreLikeThisMinWordLen

    public SolrQuery setMoreLikeThisMinWordLen​(int minwl)

Sets the minimum word length below which words will be ignored.

Parameters:
  `minwl` - the minimum word length
Returns:
  this

#### getMoreLikeThisMinWordLen

    public int getMoreLikeThisMinWordLen()

Gets the minimum word length below which words will be ignored.

#### setMoreLikeThisMaxWordLen

    public SolrQuery setMoreLikeThisMaxWordLen​(int maxwl)

Sets the maximum word length above which words will be ignored.

Parameters:
  `maxwl` - the maximum word length
Returns:
  this

#### getMoreLikeThisMaxWordLen

    public int getMoreLikeThisMaxWordLen()

Gets the maximum word length above which words will be ignored.

#### setMoreLikeThisMaxQueryTerms

    public SolrQuery setMoreLikeThisMaxQueryTerms​(int maxqt)

Sets the maximum number of query terms that will be included in any generated query.

Parameters:
  `maxqt` - the maximum number of query terms
Returns:
  this

#### getMoreLikeThisMaxQueryTerms

    public int getMoreLikeThisMaxQueryTerms()

Gets the maximum number of query terms that will be included in any generated query.

#### setMoreLikeThisMaxTokensParsed

    public SolrQuery setMoreLikeThisMaxTokensParsed​(int maxntp)

Sets the maximum number of tokens to parse in each example doc field that is not stored with TermVector support.

Parameters:
  `maxntp` - the maximum number of tokens to parse
Returns:
  this

#### getMoreLikeThisMaxTokensParsed

    public int getMoreLikeThisMaxTokensParsed()

Gets the maximum number of tokens to parse in each example doc field that is not stored with TermVector support.

#### setMoreLikeThisBoost

    public SolrQuery setMoreLikeThisBoost​(boolean b)

Sets if the query will be boosted by the interesting term relevance.

Parameters:
  `b` - set to true to boost the query with the interesting term relevance
Returns:
  this

#### getMoreLikeThisBoost

    public boolean getMoreLikeThisBoost()

Gets if the query will be boosted by the interesting term relevance.

#### setMoreLikeThisQF

    public SolrQuery setMoreLikeThisQF​(String qf)

Sets the query fields and their boosts using the same format as that used in DisMaxQParserPlugin. These fields must also be added using `addMoreLikeThisField(String)`.

Parameters:
  `qf` - the query fields
Returns:
  this

#### getMoreLikeThisQF

    public String getMoreLikeThisQF()

Gets the query fields and their boosts.

#### setMoreLikeThisCount

    public SolrQuery setMoreLikeThisCount​(int count)

Sets the number of similar documents to return for each result.

Parameters:
  `count` - the number of similar documents to return for each result
Returns:
  this

#### getMoreLikeThisCount

    public int getMoreLikeThisCount()

Gets the number of similar documents to return for each result.

#### setMoreLikeThis

    public SolrQuery setMoreLikeThis​(boolean b)

Enable/Disable MoreLikeThis. After enabling MoreLikeThis, the fields used for computing similarity must be specified calling `addMoreLikeThisField(String)`.

Parameters:
  `b` - flag to indicate if MoreLikeThis should be enabled. if b==false removes all mlt.* parameters
Returns:
  this

#### getMoreLikeThis

    public boolean getMoreLikeThis()

Returns:
  true if MoreLikeThis is enabled, false otherwise

#### setFields

    public SolrQuery setFields​(String... fields)

#### addField

    public SolrQuery addField​(String field)

#### getFields

    public String getFields()

#### setIncludeScore

    public SolrQuery setIncludeScore​(boolean includeScore)

#### setQuery

    public SolrQuery setQuery​(String query)

#### getQuery

    public String getQuery()

#### setRows

    public SolrQuery setRows​(Integer rows)

#### getRows

    public Integer getRows()

#### setShowDebugInfo

    public SolrQuery setShowDebugInfo​(boolean showDebugInfo)

#### setDistrib

    public void setDistrib​(boolean val)

#### setStart

    public SolrQuery setStart​(Integer start)

#### getStart

    public Integer getStart()

#### setRequestHandler

    public SolrQuery setRequestHandler​(String qt)

The Request Handler to use (see the solrconfig.xml), which is stored in the "qt" parameter. Normally it starts with a '/' and if so it will be used by `QueryRequest.getPath()` in the URL instead of the "qt" parameter. If this is left blank, then the default of "/select" is assumed.

Parameters:
  `qt` - The Request Handler name corresponding to one in solrconfig.xml on the server.
Returns:
  this

#### getRequestHandler

    public String getRequestHandler()

#### setParam

    public SolrQuery setParam​(String name,
                              String... values)

Returns:
  this
See Also:
  `ModifiableSolrParams.set(String,String[])`

#### setParam

    public SolrQuery setParam​(String name,
                              boolean value)

Returns:
  this
See Also:
  `ModifiableSolrParams.set(String, boolean)`

#### getCopy

    public SolrQuery getCopy()

get a deep copy of this object *

#### setTimeAllowed

    public SolrQuery setTimeAllowed​(Integer milliseconds)

Set the maximum time allowed for this query. If the query takes more time than the specified milliseconds, a timeout occurs and partial (or no) results may be returned.

If given Integer is null, then this parameter is removed from the request

Parameters:
  `milliseconds` - the time in milliseconds allowed for this query

#### getTimeAllowed

    public Integer getTimeAllowed()

Get the maximum time allowed for this query.