public class CmsSolrQuery
extends org.apache.solr.client.solrj.SolrQuery
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
ALL_RETURN_FIELDS
A constant to add the score field to the result documents.
|
static java.lang.String |
DEFAULT_FACET_DATE_GAP
The default facet date gap.
|
static java.lang.String |
DEFAULT_QUERY
The default query.
|
static java.lang.String |
DEFAULT_QUERY_TYPE
The query type.
|
static java.lang.Integer |
DEFAULT_ROWS
The default search result count.
|
static java.lang.String |
MINIMUM_FIELDS
A constant to add the score field to the result documents.
|
static java.lang.String |
STRUCTURE_FIELDS
A constant to add the score field to the result documents.
|
| 构造器和说明 |
|---|
CmsSolrQuery()
Default constructor.
|
CmsSolrQuery(CmsObject cms,
java.util.Map<java.lang.String,java.lang.String[]> queryParams)
Public constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addFilterQuery(java.lang.String fieldName,
java.util.List<java.lang.String> vals,
boolean all,
boolean useQuotes)
Creates and adds a filter query.
|
void |
addSortFieldOrders(java.util.Map<java.lang.String,org.apache.solr.client.solrj.SolrQuery.ORDER> sortFields)
Adds the given fields/orders to the existing sort fields.
|
CmsSolrQuery |
clone() |
void |
ensureParameters()
Ensures that the initial request parameters will overwrite the member values.
|
static java.lang.String |
getResourceType(java.lang.String[] fqs)
Returns the resource type if only one is set as filter query.
|
void |
removeExpiration()
Removes the expiration flag.
|
void |
setCategories(java.util.List<java.lang.String> categories)
Sets the categories only if not set in the query parameters.
|
void |
setCategories(java.lang.String... categories)
Sets the categories only if not set in the query parameters.
|
void |
setDateRanges(java.util.Map<java.lang.String,CmsPair<java.util.Date,java.util.Date>> dateRanges)
Sets date ranges.
|
void |
setFacetDateGap(java.lang.String facetDateGap)
Sets the facetDateGap.
|
void |
setLocales(java.util.List<java.util.Locale> locales)
Sets the locales only if not set in the query parameters.
|
void |
setLocales(java.util.Locale... locales)
Sets the locales only if not set in the query parameters.
|
void |
setResourceTypes(java.util.List<java.lang.String> resourceTypes)
Sets the resource types only if not set in the query parameters.
|
void |
setResourceTypes(java.lang.String... resourceTypes)
Sets the resource types only if not set in the query parameters.
|
void |
setSearchRoots(java.util.List<java.lang.String> searchRoots)
Sets the search roots only if not set as query parameter.
|
void |
setSearchRoots(java.lang.String... searchRoots)
Sets the search roots only if not set as query parameter.
|
void |
setStructureQuery(boolean structureQuery)
Sets the return fields 'fl' to a predefined set that does not contain content specific fields.
|
void |
setText(java.lang.String text)
Sets the text.
|
void |
setTextSearchFields(java.util.List<java.lang.String> textSearchFields)
Sets the textSearchFields.
|
void |
setTextSearchFields(java.lang.String... textSearchFields)
Sets the textSearchFields.
|
java.lang.String |
toString() |
addDateRangeFacet, addFacetField, addFacetPivotField, addFacetQuery, addField, addFilterQuery, addHighlightField, addNumericRangeFacet, addOrUpdateSort, addOrUpdateSort, addSort, addSort, addSortField, addStatsFieldFacets, addTermsField, clearSorts, getCopy, getFacetFields, getFacetLimit, getFacetMinCount, getFacetQuery, getFacetSort, getFacetSortString, getFields, getFilterQueries, getHighlight, getHighlightFields, getHighlightFragsize, getHighlightRequireFieldMatch, getHighlightSimplePost, getHighlightSimplePre, getHighlightSnippets, getQuery, getQueryType, getRequestHandler, getRows, getSortField, getSortFields, getSorts, getStart, getTerms, getTermsFields, getTermsLimit, getTermsLower, getTermsLowerInclusive, getTermsMaxCount, getTermsMinCount, getTermsPrefix, getTermsRaw, getTermsRegex, getTermsRegexFlags, getTermsSortString, getTermsUpper, getTermsUpperInclusive, getTimeAllowed, removeFacetField, removeFacetQuery, removeFilterQuery, removeHighlightField, removeSort, removeSort, removeSortField, setFacet, setFacetLimit, setFacetMinCount, setFacetMissing, setFacetPrefix, setFacetPrefix, setFacetSort, setFacetSort, setFields, setFilterQueries, setGetFieldStatistics, setGetFieldStatistics, setHighlight, setHighlightFragsize, setHighlightRequireFieldMatch, setHighlightSimplePost, setHighlightSimplePre, setHighlightSnippets, setIncludeScore, setMissing, setParam, setParam, setQuery, setQueryType, setRequestHandler, setRows, setShowDebugInfo, setSort, setSort, setSortField, setSorts, setStart, setTerms, setTermsLimit, setTermsLower, setTermsLowerInclusive, setTermsMaxCount, setTermsMinCount, setTermsPrefix, setTermsRaw, setTermsRegex, setTermsRegexFlag, setTermsSortString, setTermsUpper, setTermsUpperInclusive, setTimeAllowedadd, add, clear, get, getParameterNames, getParameterNamesIterator, getParams, remove, remove, set, set, setfpname, get, getBool, getBool, getDouble, getDouble, getFieldBool, getFieldBool, getFieldDouble, getFieldDouble, getFieldFloat, getFieldFloat, getFieldInt, getFieldInt, getFieldParam, getFieldParam, getFieldParams, getFloat, getFloat, getInt, getInt, required, toMap, toMultiMap, toNamedList, toSolrParams, wrapAppended, wrapDefaultspublic static final java.lang.String ALL_RETURN_FIELDS
public static final java.lang.String DEFAULT_FACET_DATE_GAP
public static final java.lang.String DEFAULT_QUERY
public static final java.lang.String DEFAULT_QUERY_TYPE
public static final java.lang.Integer DEFAULT_ROWS
public static final java.lang.String MINIMUM_FIELDS
public static final java.lang.String STRUCTURE_FIELDS
public CmsSolrQuery()
public CmsSolrQuery(CmsObject cms, java.util.Map<java.lang.String,java.lang.String[]> queryParams)
cms - the current OpenCms contextqueryParams - the Solr query parameterspublic static java.lang.String getResourceType(java.lang.String[] fqs)
fqs - the field queries to checknullpublic void addFilterQuery(java.lang.String fieldName,
java.util.List<java.lang.String> vals,
boolean all,
boolean useQuotes)
fieldName - the field name to create a filter query onvals - the values that should match for the given fieldall - true to combine the given values with 'AND', false for 'OR'useQuotes - true to surround the given values with double quotes, false otherwisepublic void addSortFieldOrders(java.util.Map<java.lang.String,org.apache.solr.client.solrj.SolrQuery.ORDER> sortFields)
sortFields - the sortFields to setpublic CmsSolrQuery clone()
clone 在类中 java.lang.ObjectObject.clone()public void ensureParameters()
You can initialize the query with an HTTP request parameter then make some method calls and finally re-ensure that the initial request parameters will overwrite the changes made in the meanwhile.
public void removeExpiration()
public void setCategories(java.util.List<java.lang.String> categories)
categories - the categories to setpublic void setCategories(java.lang.String... categories)
categories - the categories to setpublic void setDateRanges(java.util.Map<java.lang.String,CmsPair<java.util.Date,java.util.Date>> dateRanges)
This call will overwrite all existing date ranges for the given keys (name of the date facet field).
The parameter Map uses as:
keys: Solr field name CmsSearchField and
values: pairs with min date as first and max date as second CmsPair
+created:[* TO NOW]
+lastmodified:[' + date + ' TO NOW]
CmsSolrDocument.DF
dateRanges - the ranges map with field name as key and a CmsPair with min date as first and max date as secondpublic void setFacetDateGap(java.lang.String facetDateGap)
facetDateGap - the facetDateGap to setpublic void setLocales(java.util.List<java.util.Locale> locales)
locales - the locales to setpublic void setLocales(java.util.Locale... locales)
locales - the locales to setpublic void setResourceTypes(java.util.List<java.lang.String> resourceTypes)
resourceTypes - the resourceTypes to setpublic void setResourceTypes(java.lang.String... resourceTypes)
resourceTypes - the resourceTypes to setpublic void setSearchRoots(java.util.List<java.lang.String> searchRoots)
searchRoots - the searchRoots to setpublic void setSearchRoots(java.lang.String... searchRoots)
searchRoots - the searchRoots to setpublic void setStructureQuery(boolean structureQuery)
structureQuery - the true to return only structural fieldspublic void setText(java.lang.String text)
text - the text to setpublic void setTextSearchFields(java.util.List<java.lang.String> textSearchFields)
textSearchFields - the textSearchFields to setpublic void setTextSearchFields(java.lang.String... textSearchFields)
textSearchFields - the textSearchFields to setpublic java.lang.String toString()
toString 在类中 org.apache.solr.common.params.ModifiableSolrParamsModifiableSolrParams.toString()