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
|
SolrQuery(String k,
String v,
String... params) |
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 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-2016 Apache Software Foundation. All Rights Reserved.