|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.solr.common.params.SolrParams org.apache.solr.common.params.ModifiableSolrParams org.apache.solr.client.solrj.SolrQuery
public class SolrQuery
This is an augmented SolrParams with get/set/add fields for common fields used in the Standard and Dismax request handlers
Nested Class Summary | |
---|---|
static class |
SolrQuery.ORDER
|
static class |
SolrQuery.SortClause
A single sort clause, encapsulating what to sort and the sort order. |
Field Summary | |
---|---|
static String |
DOCID
|
Constructor Summary | |
---|---|
SolrQuery()
|
|
SolrQuery(String q)
Create a new SolrQuery |
Method Summary | |
---|---|
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. use setFacetMissing(Boolean) |
SolrQuery |
setParam(String name,
boolean value)
|
SolrQuery |
setParam(String name,
String... values)
|
SolrQuery |
setQuery(String query)
|
SolrQuery |
setQueryType(String qt)
Deprecated. See setRequestHandler(String) . |
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. |
Methods inherited from class org.apache.solr.common.params.ModifiableSolrParams |
---|
add, add, clear, get, getParameterNames, getParameterNamesIterator, getParams, remove, remove, set, set, set, toString |
Methods inherited from class org.apache.solr.common.params.SolrParams |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String DOCID
Constructor Detail |
---|
public SolrQuery()
public SolrQuery(String q)
q
- query stringMethod Detail |
---|
public SolrQuery setTerms(boolean b)
b
- flag to indicate terms should be enabled. public boolean getTerms()
public SolrQuery addTermsField(String field)
public String[] getTermsFields()
public SolrQuery setTermsLower(String lower)
public String getTermsLower()
public SolrQuery setTermsUpper(String upper)
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 SolrQuery setTermsPrefix(String prefix)
public String getTermsPrefix()
public SolrQuery setTermsRaw(boolean b)
public boolean getTermsRaw()
public SolrQuery setTermsSortString(String type)
public String getTermsSortString()
public SolrQuery setTermsRegex(String regex)
public String getTermsRegex()
public SolrQuery setTermsRegexFlag(String flag)
public String[] getTermsRegexFlags()
public SolrQuery addFacetField(String... fields)
fields
- Array of field names from the IndexSchema
public SolrQuery addFacetPivotField(String... fields)
fields
- Array of field names from the IndexSchema
public 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 count
public 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 count
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 setFacetPrefix(String prefix)
public SolrQuery setFacetPrefix(String field, String prefix)
public SolrQuery addFacetQuery(String f)
f
- facet querypublic String[] getFacetQuery()
public boolean removeFacetQuery(String q)
q
- the facet query to remove
public 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 facets
public SolrQuery addHighlightField(String f)
f
- field to enable for highlightingpublic boolean removeHighlightField(String f)
f
- field name to not highlight
public 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 SolrQuery setHighlightSimplePre(String f)
public String getHighlightSimplePre()
public SolrQuery setHighlightSimplePost(String f)
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 addStatsFieldFacets(String field, String... facets)
public void addStatsFieldCalcDistinct(String field, boolean calcDistinct)
public SolrQuery setFilterQueries(String... fq)
public SolrQuery addFilterQuery(String... fq)
public boolean removeFilterQuery(String fq)
public String[] getFilterQueries()
public boolean getHighlight()
public SolrQuery setHighlight(boolean b)
public SolrQuery setFields(String... fields)
public SolrQuery addField(String field)
public String getFields()
public SolrQuery setIncludeScore(boolean includeScore)
public SolrQuery setQuery(String query)
public String getQuery()
public SolrQuery setRows(Integer rows)
public Integer getRows()
public void setShowDebugInfo(boolean showDebugInfo)
public void setDistrib(boolean val)
public SolrQuery setStart(Integer start)
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |