public class SolrQuery extends ModifiableSolrParams
Modifier and Type | Class and Description |
---|---|
static class |
SolrQuery.ORDER |
static class |
SolrQuery.SortClause
A single sort clause, encapsulating what to sort and the sort order.
|
MapWriter.EntryWriter
Constructor and Description |
---|
SolrQuery() |
SolrQuery(String q)
Create a new SolrQuery
|
SolrQuery(String k,
String v,
String... params) |
Modifier and Type | Method and Description |
---|---|
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(SolrQuery.SortClause sortClause)
Updates or adds a single sort field specification to the current sort
information.
|
SolrQuery |
addOrUpdateSort(String field,
SolrQuery.ORDER order)
Updates or adds a single sort clause to the query.
|
SolrQuery |
addSort(SolrQuery.SortClause sortClause)
Adds a single sort clause to the end of the query.
|
SolrQuery |
addSort(String field,
SolrQuery.ORDER order)
Adds a single sort clause to the end of the current sort information.
|
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(SolrQuery.SortClause sortClause)
Removes a single sort field from the current sort information.
|
SolrQuery |
removeSort(String itemName)
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(SolrQuery.SortClause sortClause)
Replaces the current sort information with a single sort clause
|
SolrQuery |
setSort(String field,
SolrQuery.ORDER order)
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.
|
add, add, clear, get, getMap, getParameterNames, getParameterNamesIterator, getParams, iterator, of, remove, remove, set, set, set, setNonNull, size
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
forEach, spliterator
public static final String DOCID
public SolrQuery()
public SolrQuery(String q)
q
- query stringpublic SolrQuery setTerms(boolean b)
b
- flag to indicate terms should be enabled. public boolean getTerms()
public String[] getTermsFields()
public String getTermsLower()
public String getTermsUpper()
public SolrQuery setTermsUpperInclusive(boolean b)
public boolean getTermsUpperInclusive()
public SolrQuery setTermsLowerInclusive(boolean b)
public boolean getTermsLowerInclusive()
public SolrQuery setTermsLimit(int limit)
public int getTermsLimit()
public SolrQuery setTermsMinCount(int cnt)
public int getTermsMinCount()
public SolrQuery setTermsMaxCount(int cnt)
public int getTermsMaxCount()
public String getTermsPrefix()
public SolrQuery setTermsRaw(boolean b)
public boolean getTermsRaw()
public String getTermsSortString()
public String getTermsRegex()
public String[] getTermsRegexFlags()
public SolrQuery addFacetField(String... fields)
fields
- Array of field names from the IndexSchemapublic SolrQuery addFacetPivotField(String... fields)
fields
- Array of field names from the IndexSchemapublic SolrQuery addNumericRangeFacet(String field, Number start, Number end, Number gap)
field
- The fieldstart
- The start of rangeend
- The end of the rangegap
- The gap between each countpublic SolrQuery addDateRangeFacet(String field, Date start, Date end, String gap)
field
- The fieldstart
- The start of rangeend
- The end of the rangegap
- The gap between each countpublic SolrQuery addIntervalFacets(String field, String[] intervals)
ModifiableSolrParams.add(java.lang.String, java.lang.String...)
method.field
- the field to add facet intervals. Must be an existing field and can't be nullintervals
- Intervals to be used for faceting. It can be an empty array, but it can't
be null
public String[] removeIntervalFacets(String field)
field
- the field to remove from facet intervalsfield
public String[] getFacetFields()
public boolean removeFacetField(String name)
name
- Name of the facet field to be removed.public SolrQuery setFacet(boolean b)
b
- flag to indicate faceting should be enabled. public SolrQuery addFacetQuery(String f)
f
- facet querypublic String[] getFacetQuery()
public boolean removeFacetQuery(String q)
q
- the facet query to removepublic SolrQuery setFacetLimit(int lim)
lim
- number facet items to returnpublic int getFacetLimit()
public SolrQuery setFacetMinCount(int cnt)
cnt
- facets having less that cnt hits will be excluded from teh facet listpublic int getFacetMinCount()
public SolrQuery setFacetMissing(Boolean v)
v
- flag to indicate the field of FacetParams.FACET_MISSING
.public String getFacetSortString()
FacetParams.FACET_SORT_COUNT
public SolrQuery setFacetSort(String sort)
sort
- sort facetspublic SolrQuery addHighlightField(String f)
f
- field to enable for highlightingpublic boolean removeHighlightField(String f)
f
- field name to not highlightpublic String[] getHighlightFields()
public SolrQuery setHighlightSnippets(int num)
public int getHighlightSnippets()
public SolrQuery setHighlightFragsize(int num)
public int getHighlightFragsize()
public SolrQuery setHighlightRequireFieldMatch(boolean flag)
public boolean getHighlightRequireFieldMatch()
public String getHighlightSimplePre()
public String getHighlightSimplePost()
public String getSortField()
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)
.
public SolrQuery clearSorts()
public SolrQuery setSorts(List<SolrQuery.SortClause> value)
public List<SolrQuery.SortClause> getSorts()
public SolrQuery setSort(String field, SolrQuery.ORDER order)
public SolrQuery setSort(SolrQuery.SortClause sortClause)
public SolrQuery addSort(String field, SolrQuery.ORDER order)
public SolrQuery addSort(SolrQuery.SortClause sortClause)
public SolrQuery addOrUpdateSort(String field, SolrQuery.ORDER order)
public SolrQuery addOrUpdateSort(SolrQuery.SortClause sortClause)
public SolrQuery removeSort(SolrQuery.SortClause sortClause)
public SolrQuery removeSort(String itemName)
public void setGetFieldStatistics(boolean v)
public void setGetFieldStatistics(String field)
public void addGetFieldStatistics(String... field)
public void addStatsFieldCalcDistinct(String field, boolean calcDistinct)
public boolean removeFilterQuery(String fq)
public String[] getFilterQueries()
public boolean getHighlight()
public SolrQuery setHighlight(boolean b)
public SolrQuery addMoreLikeThisField(String field)
field
- the names of the field to be addedpublic String[] getMoreLikeThisFields()
public SolrQuery setMoreLikeThisMinTermFreq(int mintf)
mintf
- the minimum term frequencypublic int getMoreLikeThisMinTermFreq()
public SolrQuery setMoreLikeThisMinDocFreq(int mindf)
mindf
- the minimum document frequencypublic int getMoreLikeThisMinDocFreq()
public SolrQuery setMoreLikeThisMinWordLen(int minwl)
minwl
- the minimum word lengthpublic int getMoreLikeThisMinWordLen()
public SolrQuery setMoreLikeThisMaxWordLen(int maxwl)
maxwl
- the maximum word lengthpublic int getMoreLikeThisMaxWordLen()
public SolrQuery setMoreLikeThisMaxQueryTerms(int maxqt)
maxqt
- the maximum number of query termspublic int getMoreLikeThisMaxQueryTerms()
public SolrQuery setMoreLikeThisMaxTokensParsed(int maxntp)
maxntp
- the maximum number of tokens to parsepublic int getMoreLikeThisMaxTokensParsed()
public SolrQuery setMoreLikeThisBoost(boolean b)
b
- set to true to boost the query with the interesting term relevancepublic boolean getMoreLikeThisBoost()
public SolrQuery setMoreLikeThisQF(String qf)
addMoreLikeThisField(String)
.qf
- the query fieldspublic String getMoreLikeThisQF()
public SolrQuery setMoreLikeThisCount(int count)
count
- the number of similar documents to return for each resultpublic int getMoreLikeThisCount()
public SolrQuery setMoreLikeThis(boolean b)
addMoreLikeThisField(String)
.b
- flag to indicate if MoreLikeThis should be enabled. if b==false
removes all mlt.* parameterspublic boolean getMoreLikeThis()
public String getFields()
public SolrQuery setIncludeScore(boolean includeScore)
public String getQuery()
public Integer getRows()
public SolrQuery setShowDebugInfo(boolean showDebugInfo)
public void setDistrib(boolean val)
public Integer getStart()
public SolrQuery setRequestHandler(String qt)
QueryRequest.getPath()
in the URL instead of the "qt" parameter.
If this is left blank, then the default of "/select" is assumed.qt
- The Request Handler name corresponding to one in solrconfig.xml on the server.public String getRequestHandler()
public SolrQuery setParam(String name, String... values)
ModifiableSolrParams.set(String,String[])
public SolrQuery setParam(String name, boolean value)
ModifiableSolrParams.set(String, boolean)
public SolrQuery getCopy()
public SolrQuery setTimeAllowed(Integer milliseconds)
milliseconds
- the time in milliseconds allowed for this querypublic Integer getTimeAllowed()
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.