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) |
SolrQuery |
addHighlightField(String f)
add highlight 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.
|
SolrQuery |
addSortField(String field,
SolrQuery.ORDER order)
Deprecated.
Use
addSort(SortClause) instead, which is part
of an api handling a wider range of sort specifications. |
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
|
boolean |
getFacetSort()
Deprecated.
Use
getFacetSortString() instead. |
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 |
getQueryType()
Deprecated.
See
getRequestHandler() . |
String |
getRequestHandler() |
Integer |
getRows() |
String |
getSortField()
Gets the raw sort field, as it will be sent to Solr.
|
String[] |
getSortFields()
Deprecated.
Use
getSorts() instead, which is part
of an api handling a wider range of sort specifications. |
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
|
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.
|
SolrQuery |
removeSortField(String field,
SolrQuery.ORDER order)
Deprecated.
Use
removeSort(SortClause) instead, which is part
of an api handling a wider range of sort specifications. |
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(boolean sort)
Deprecated.
Use
setFacetSort(String) instead, true corresponds to
FacetParams.FACET_SORT_COUNT and false to FacetParams.FACET_SORT_INDEX . |
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 |
setMissing(String fld)
Deprecated.
|
SolrQuery |
setParam(String name,
boolean value) |
SolrQuery |
setParam(String name,
String... values) |
SolrQuery |
setQuery(String query) |
SolrQuery |
setQueryType(String qt)
Deprecated.
|
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 |
setSortField(String field,
SolrQuery.ORDER order)
Deprecated.
Use
setSort(SortClause) instead, which is part
of an api handling a wider range of sort specifications. |
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, getParameterNames, getParameterNamesIterator, getParams, remove, remove, set, set, set, toString
fpname, get, getBool, getBool, getDouble, getDouble, getFieldBool, getFieldBool, getFieldDouble, getFieldDouble, getFieldFloat, getFieldFloat, getFieldInt, getFieldInt, getFieldParam, getFieldParam, getFieldParams, getFloat, getFloat, getInt, getInt, required, toFilteredSolrParams, toMap, toMultiMap, toNamedList, toSolrParams, 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 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
.@Deprecated public SolrQuery setMissing(String fld)
setFacetMissing(Boolean)
public String getFacetSortString()
FacetParams.FACET_SORT_COUNT
@Deprecated public boolean getFacetSort()
getFacetSortString()
instead.FacetParams.FACET_SORT_COUNT
and FacetParams.FACET_SORT_INDEX
public SolrQuery setFacetSort(String sort)
sort
- sort facets@Deprecated public SolrQuery setFacetSort(boolean sort)
setFacetSort(String)
instead, true corresponds to
FacetParams.FACET_SORT_COUNT
and false to FacetParams.FACET_SORT_INDEX
.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()
@Deprecated public SolrQuery setSortField(String field, SolrQuery.ORDER order)
setSort(SortClause)
instead, which is part
of an api handling a wider range of sort specifications.@Deprecated public SolrQuery addSortField(String field, SolrQuery.ORDER order)
addSort(SortClause)
instead, which is part
of an api handling a wider range of sort specifications.@Deprecated public SolrQuery removeSortField(String field, SolrQuery.ORDER order)
removeSort(SortClause)
instead, which is part
of an api handling a wider range of sort specifications.@Deprecated public String[] getSortFields()
getSorts()
instead, which is part
of an api handling a wider range of sort specifications.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 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()
@Deprecated public SolrQuery setQueryType(String qt)
setRequestHandler(String)
.@Deprecated public String getQueryType()
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-2014 Apache Software Foundation. All Rights Reserved.