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.
|
Constructor and Description |
---|
SolrQuery() |
SolrQuery(String q)
Create a new SolrQuery
|
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 |
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() |
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 |
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) |
void |
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, remove, remove, set, set, set, size
fpname, get, getAll, getBool, getBool, getDouble, getDouble, getFieldBool, getFieldBool, getFieldDouble, getFieldDouble, getFieldFloat, getFieldFloat, getFieldInt, getFieldInt, getFieldParam, getFieldParam, getFieldParams, getFloat, getFloat, getInt, getInt, getLong, getLong, getLong, required, toFilteredSolrParams, toMap, toMultiMap, toNamedList, toQueryString, toSolrParams, toString, wrapAppended, wrapDefaults
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 String getFields()
public SolrQuery setIncludeScore(boolean includeScore)
public String getQuery()
public Integer getRows()
public void 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-2016 Apache Software Foundation. All Rights Reserved.