Class CmsSolrIndex
- java.lang.Object
-
- org.opencms.search.A_CmsSearchIndex
-
- org.opencms.search.CmsSearchIndex
-
- org.opencms.search.solr.CmsSolrIndex
-
- All Implemented Interfaces:
java.io.Serializable
,I_CmsConfigurationParameterHandler
,I_CmsSearchIndex
public class CmsSolrIndex extends CmsSearchIndex
Implements the search within an Solr index.- Since:
- 8.5.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEBUG_PADDING_RIGHT
A constant for debug formatting output.static java.lang.String
DEFAULT_INDEX_NAME_OFFLINE
The name of the default Solr Offline index.static java.lang.String
DEFAULT_INDEX_NAME_ONLINE
The name of the default Solr Online index.static int
MAX_RESULTS_GALLERY
The constant for an unlimited maximum number of results to return in a Solr search.static int
MAX_RESULTS_UNLIMITED
The constant for an unlimited maximum number of results to return in a Solr search.static java.lang.String
POST_PROCESSOR
Constant for additional parameter to set the post processor class name.static java.lang.String
PROPERTY_SEARCH_EXCLUDE_VALUE_SOLR
The solr exclude property.static int
ROWS_MAX
Indicates the maximum number of documents from the complete result set to return.static java.lang.String
SOLR_HANDLER_ALLOWED_FIELDS
Constant for additional parameter to set the fields the select handler should return at maximum.static java.lang.String
SOLR_HANDLER_MAX_ALLOWED_RESULTS_AT_ALL
Constant for additional parameter to set the maximal number of a result, the select handler should return.static java.lang.String
SOLR_HANDLER_MAX_ALLOWED_RESULTS_PER_PAGE
Constant for additional parameter to set the number results the select handler should return at maxium per request.static java.lang.String
SOLR_SEARCH_MAX_PROCESSED_RESULTS
Constant for additional parameter to set the maximally processed results (start + rows) for searches with this index.-
Fields inherited from class org.opencms.search.CmsSearchIndex
A_PARAM_PREFIX, BACKUP_REINDEXING, DATES, DOC_META_FIELDS, EXCERPT, EXTRACT_CONTENT, IGNORE_EXPIRATION, LANGUAGEDETECTION, LUCENE_AUTO_COMMIT, LUCENE_RAM_BUFFER_SIZE_MB, MAX_HITS, MAX_HITS_DEFAULT, MAX_YEAR_RANGE, PERMISSIONS, PRIORITY, TIME_RANGE, VISITOR
-
Fields inherited from class org.opencms.search.A_CmsSearchIndex
PROPERTY_SEARCH_EXCLUDE_VALUE_ALL, PROPERTY_SEARCH_EXCLUDE_VALUE_GALLERY, USE_ALL_LOCALE
-
Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
-
Fields inherited from interface org.opencms.search.I_CmsSearchIndex
REBUILD_MODE_AUTO, REBUILD_MODE_MANUAL, REBUILD_MODE_NEVER, REBUILD_MODE_OFFLINE
-
-
Constructor Summary
Constructors Constructor Description CmsSolrIndex()
Default constructor.CmsSolrIndex(java.lang.String name)
Public constructor to create a Solr index.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addConfigurationParameter(java.lang.String key, java.lang.String value)
Adds a parameter.I_CmsSearchDocument
createEmptyDocument(CmsResource resource)
Creates an empty document that can be used by this search field configuration.protected java.lang.String
createIndexBackup()
Creates a backup of this index for optimized re-indexing of the whole content.I_CmsIndexWriter
createIndexWriter(boolean create, I_CmsReport report)
Creates a new index writer.boolean
excludeFromIndex(CmsObject cms, CmsResource resource)
Checks if the provided resource should be excluded from this search index.CmsGallerySearchResultList
gallerySearch(CmsObject cms, CmsGallerySearchParameters params)
Performs a search with according to the gallery search parameters.CmsParameterConfiguration
getConfiguration()
Returns the empty configuration.java.lang.String
getCoreName()
Returns the name of the core of the index.I_CmsSearchDocument
getDocument(java.lang.String fieldname, java.lang.String term)
Returns the first document where the given term matches the selected index field.I_CmsSearchDocument
getDocument(java.lang.String fieldname, java.lang.String term, java.lang.String[] fls)
Version ofCmsSearchIndex.getDocument(java.lang.String, java.lang.String)
where the returned fields can be restricted.java.util.Locale
getLocaleForResource(CmsObject cms, CmsResource resource, java.util.List<java.util.Locale> availableLocales)
Returns the language locale for the given resource in this index.int
getMaxProcessedResults()
Returns the maximal number of results (start + rows) that are processed for each search query unless another maximum is explicitly specified insearch(CmsObject, CmsSolrQuery, boolean, ServletResponse, boolean, CmsResourceFilter, int)
.I_CmsSolrPostSearchProcessor
getPostProcessor()
Returns the search post processor.java.lang.String
getServerUrl()
Returns the Solr server URL to connect to for this specific index, ornull
if no specific URL is configured.static java.lang.String
getType(CmsObject cms, java.lang.String rootPath)
Returns the resource type for the given root path.protected boolean
hasPermissions(CmsObject cms, CmsSolrDocument doc, CmsResourceFilter filter)
Check, if the current user has permissions on the document's resource.protected void
indexSearcherClose()
Closes the index searcher for this index.protected void
indexSearcherOpen(java.lang.String path)
Initializes the index searcher for this index.protected void
indexSearcherUpdate()
Reopens the index search reader for this index, required after the index has been changed.void
initialize()
Initializes the search index.boolean
isNoSolrServerSet()
Returns a flag, indicating if the Solr server is not yet set.CmsSolrResultList
search(CmsObject cms, java.lang.String solrQuery)
Performs a search.CmsSolrResultList
search(CmsObject cms, org.apache.solr.client.solrj.SolrQuery query)
Default search method.CmsSearchResultList
search(CmsObject cms, CmsSearchParameters params)
Deprecated.Usesearch(CmsObject, SolrQuery)
orsearch(CmsObject, String)
insteadCmsSolrResultList
search(CmsObject cms, CmsSolrQuery query)
Default search method.CmsSolrResultList
search(CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows)
Performs a search.CmsSolrResultList
search(CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows, javax.servlet.ServletResponse response, boolean ignoreSearchExclude, CmsResourceFilter filter)
Performs the actual search.CmsSolrResultList
search(CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows, javax.servlet.ServletResponse response, boolean ignoreSearchExclude, CmsResourceFilter filter, int maxNumResults)
Performs the actual search.CmsSolrResultList
search(CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows, CmsResourceFilter filter)
Likesearch(CmsObject, CmsSolrQuery, boolean)
, but additionally a resource filter can be specified.void
select(javax.servlet.ServletResponse response, CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows)
Writes the response into the writer.void
setName(java.lang.String name)
Sets the logical key/name of this search index.void
setPostProcessor(I_CmsSolrPostSearchProcessor postProcessor)
Sets the search post processor.void
setSolrServer(org.apache.solr.client.solrj.SolrClient client)
Sets the Solr server used by this index.void
spellCheck(javax.servlet.ServletResponse res, CmsObject cms, CmsSolrQuery q)
Executes a spell checking Solr query and returns the Solr query response.-
Methods inherited from class org.opencms.search.CmsSearchIndex
appendCategoryFilter, appendDateCreatedFilter, appendDateLastModifiedFilter, appendPathFilter, appendResourceTypeFilter, createDateRangeFilter, extendPathFilter, generateIndexDirectory, getAnalyzer, getContentIfUnchanged, getDateRangeSpan, getDocument, getDocument, getLocaleString, getMaxHits, getMultiTermQueryFilter, getMultiTermQueryFilter, getMultiTermQueryFilter, getPath, getPriority, getResource, getResource, getSearcher, getTermQueryFilter, hasReadPermission, indexSearcherClose, isBackupReindexing, isCheckingPermissions, isCheckingTimeRange, isCheckPermissions, isCreatingExcerpt, isIgnoreExpiration, isInitialized, isInTimeRange, isRequireViewPermission, isSortScoring, needsPermissionCheck, onIndexChanged, removeIndexBackup, setAnalyzer, setCheckPermissions, setIgnoreExpiration, setMaxHits, setRequireViewPermission, shutDown, toString
-
Methods inherited from class org.opencms.search.A_CmsSearchIndex
addSourceName, checkConfiguration, equals, getDocumentFactory, getFieldConfiguration, getFieldConfigurationName, getIndexWriter, getLocale, getName, getProject, getRebuildMode, getSourceNames, getSources, hashCode, initConfiguration, isEnabled, isExtractingContent, isIndexing, isLanguageDetection, isUpdatedIncremental, removeSourceName, setEnabled, setExtractContent, setFieldConfiguration, setFieldConfigurationName, setIndexWriter, setLanguageDetection, setLocale, setLocaleString, setPath, setProject, setRebuildMode
-
-
-
-
Field Detail
-
DEFAULT_INDEX_NAME_OFFLINE
public static final java.lang.String DEFAULT_INDEX_NAME_OFFLINE
The name of the default Solr Offline index.- See Also:
- Constant Field Values
-
DEFAULT_INDEX_NAME_ONLINE
public static final java.lang.String DEFAULT_INDEX_NAME_ONLINE
The name of the default Solr Online index.- See Also:
- Constant Field Values
-
POST_PROCESSOR
public static final java.lang.String POST_PROCESSOR
Constant for additional parameter to set the post processor class name.- See Also:
- Constant Field Values
-
SOLR_SEARCH_MAX_PROCESSED_RESULTS
public static final java.lang.String SOLR_SEARCH_MAX_PROCESSED_RESULTS
Constant for additional parameter to set the maximally processed results (start + rows) for searches with this index. It overwrites the global configuration fromCmsSolrConfiguration.getMaxProcessedResults()
for this index.- See Also:
- Constant Field Values
-
SOLR_HANDLER_ALLOWED_FIELDS
public static final java.lang.String SOLR_HANDLER_ALLOWED_FIELDS
Constant for additional parameter to set the fields the select handler should return at maximum.- See Also:
- Constant Field Values
-
SOLR_HANDLER_MAX_ALLOWED_RESULTS_PER_PAGE
public static final java.lang.String SOLR_HANDLER_MAX_ALLOWED_RESULTS_PER_PAGE
Constant for additional parameter to set the number results the select handler should return at maxium per request.- See Also:
- Constant Field Values
-
SOLR_HANDLER_MAX_ALLOWED_RESULTS_AT_ALL
public static final java.lang.String SOLR_HANDLER_MAX_ALLOWED_RESULTS_AT_ALL
Constant for additional parameter to set the maximal number of a result, the select handler should return.- See Also:
- Constant Field Values
-
PROPERTY_SEARCH_EXCLUDE_VALUE_SOLR
public static final java.lang.String PROPERTY_SEARCH_EXCLUDE_VALUE_SOLR
The solr exclude property.- See Also:
- Constant Field Values
-
ROWS_MAX
public static final int ROWS_MAX
Indicates the maximum number of documents from the complete result set to return.- See Also:
- Constant Field Values
-
MAX_RESULTS_UNLIMITED
public static final int MAX_RESULTS_UNLIMITED
The constant for an unlimited maximum number of results to return in a Solr search.- See Also:
- Constant Field Values
-
MAX_RESULTS_GALLERY
public static final int MAX_RESULTS_GALLERY
The constant for an unlimited maximum number of results to return in a Solr search.- See Also:
- Constant Field Values
-
DEBUG_PADDING_RIGHT
protected static final int DEBUG_PADDING_RIGHT
A constant for debug formatting output.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsSolrIndex
public CmsSolrIndex()
Default constructor.
-
CmsSolrIndex
public CmsSolrIndex(java.lang.String name) throws CmsIllegalArgumentException
Public constructor to create a Solr index.- Parameters:
name
- the name for this index.- Throws:
CmsIllegalArgumentException
- if something goes wrong
-
-
Method Detail
-
getType
public static final java.lang.String getType(CmsObject cms, java.lang.String rootPath)
Returns the resource type for the given root path.- Parameters:
cms
- the current CMS contextrootPath
- the root path of the resource to get the type for- Returns:
- the resource type for the given root path
-
addConfigurationParameter
public void addConfigurationParameter(java.lang.String key, java.lang.String value)
Description copied from class:CmsSearchIndex
Adds a parameter.- Specified by:
addConfigurationParameter
in interfaceI_CmsConfigurationParameterHandler
- Overrides:
addConfigurationParameter
in classCmsSearchIndex
- Parameters:
key
- the key/name of the parametervalue
- the value of the parameter- See Also:
CmsSearchIndex.addConfigurationParameter(java.lang.String, java.lang.String)
-
createEmptyDocument
public I_CmsSearchDocument createEmptyDocument(CmsResource resource)
Description copied from class:CmsSearchIndex
Creates an empty document that can be used by this search field configuration.- Specified by:
createEmptyDocument
in interfaceI_CmsSearchIndex
- Overrides:
createEmptyDocument
in classCmsSearchIndex
- Parameters:
resource
- the resource to create the document for- Returns:
- a new and empty document
- See Also:
CmsSearchIndex.createEmptyDocument(org.opencms.file.CmsResource)
-
createIndexWriter
public I_CmsIndexWriter createIndexWriter(boolean create, I_CmsReport report)
Description copied from class:CmsSearchIndex
Creates a new index writer.- Overrides:
createIndexWriter
in classCmsSearchIndex
- Parameters:
create
- iftrue
a whole new index is created, iffalse
an existing index is updatedreport
- the report- Returns:
- the created new index writer
- See Also:
CmsSearchIndex.createIndexWriter(boolean, org.opencms.report.I_CmsReport)
-
excludeFromIndex
public boolean excludeFromIndex(CmsObject cms, CmsResource resource)
Description copied from class:A_CmsSearchIndex
Checks if the provided resource should be excluded from this search index.- Specified by:
excludeFromIndex
in interfaceI_CmsSearchIndex
- Overrides:
excludeFromIndex
in classA_CmsSearchIndex
- Parameters:
cms
- the OpenCms context used for building the search indexresource
- the resource to index- Returns:
- true if the resource should be excluded, false if it should be included in this index
- See Also:
A_CmsSearchIndex.excludeFromIndex(CmsObject, CmsResource)
-
gallerySearch
public CmsGallerySearchResultList gallerySearch(CmsObject cms, CmsGallerySearchParameters params)
Performs a search with according to the gallery search parameters.- Parameters:
cms
- the cms contextparams
- the search parameters- Returns:
- the search result
-
getConfiguration
public CmsParameterConfiguration getConfiguration()
Description copied from class:A_CmsSearchIndex
Returns the empty configuration. Override the method if your index is configurable.- Specified by:
getConfiguration
in interfaceI_CmsConfigurationParameterHandler
- Overrides:
getConfiguration
in classCmsSearchIndex
- Returns:
- the parameters of this configurable class instance,
or
null
if the class does not need any parameters - See Also:
CmsSearchIndex.getConfiguration()
-
getCoreName
public java.lang.String getCoreName()
Returns the name of the core of the index. NOTE: Index and core name differ since OpenCms 10.5 due to new naming rules for cores in SOLR.- Returns:
- the name of the core of the index.
-
getDocument
public I_CmsSearchDocument getDocument(java.lang.String fieldname, java.lang.String term)
Description copied from class:CmsSearchIndex
Returns the first document where the given term matches the selected index field.Use this method to search for documents which have unique field values, like a unique id.
- Overrides:
getDocument
in classCmsSearchIndex
- Parameters:
fieldname
- the field to search interm
- the term to search for- Returns:
- the first document where the given term matches the selected index field
- See Also:
CmsSearchIndex.getDocument(java.lang.String, java.lang.String)
-
getDocument
public I_CmsSearchDocument getDocument(java.lang.String fieldname, java.lang.String term, java.lang.String[] fls)
Version ofCmsSearchIndex.getDocument(java.lang.String, java.lang.String)
where the returned fields can be restricted.- Parameters:
fieldname
- the field to query interm
- the queryfls
- the returned fields.- Returns:
- the document.
-
getLocaleForResource
public java.util.Locale getLocaleForResource(CmsObject cms, CmsResource resource, java.util.List<java.util.Locale> availableLocales)
Returns the language locale for the given resource in this index.- Specified by:
getLocaleForResource
in interfaceI_CmsSearchIndex
- Overrides:
getLocaleForResource
in classCmsSearchIndex
- Parameters:
cms
- the current OpenCms user contextresource
- the resource to checkavailableLocales
- a list of locales supported by the resource- Returns:
- the language locale for the given resource in this index
-
getMaxProcessedResults
public int getMaxProcessedResults()
Returns the maximal number of results (start + rows) that are processed for each search query unless another maximum is explicitly specified insearch(CmsObject, CmsSolrQuery, boolean, ServletResponse, boolean, CmsResourceFilter, int)
.- Returns:
- the maximal number of results (start + rows) that are processed for a search query.
-
getPostProcessor
public I_CmsSolrPostSearchProcessor getPostProcessor()
Returns the search post processor.- Returns:
- the post processor to use
-
getServerUrl
public java.lang.String getServerUrl()
Returns the Solr server URL to connect to for this specific index, ornull
if no specific URL is configured.- Returns:
- the Solr server URL to connect to for this specific index, or
null
if no specific URL is configured.
-
initialize
public void initialize() throws CmsSearchException
Description copied from class:A_CmsSearchIndex
Initializes the search index.- Specified by:
initialize
in interfaceI_CmsSearchIndex
- Overrides:
initialize
in classCmsSearchIndex
- Throws:
CmsSearchException
- if the index source association failed or a configuration error occurred- See Also:
CmsSearchIndex.initialize()
-
isNoSolrServerSet
public boolean isNoSolrServerSet()
Returns a flag, indicating if the Solr server is not yet set.- Returns:
- a flag, indicating if the Solr server is not yet set.
-
search
@Deprecated public CmsSearchResultList search(CmsObject cms, CmsSearchParameters params)
Deprecated.Usesearch(CmsObject, SolrQuery)
orsearch(CmsObject, String)
insteadNot yet implemented for Solr.#################
### DON'T USE ###
#################
- Overrides:
search
in classCmsSearchIndex
- Parameters:
cms
- the current user's Cms objectparams
- the parameters to use for the search- Returns:
- the List of results found or an empty list
-
search
public CmsSolrResultList search(CmsObject cms, CmsSolrQuery query) throws CmsSearchException
Default search method.- Parameters:
cms
- the current CMS objectquery
- the query- Returns:
- the results
- Throws:
CmsSearchException
- if something goes wrong- See Also:
search(CmsObject, String)
-
search
public CmsSolrResultList search(CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows) throws CmsSearchException
Performs a search.Returns a list of 'OpenCms resource documents' (
CmsSearchResource
) encapsulated within the classCmsSolrResultList
. This list can be accessed exactly like anList
which entries areCmsSearchResource
that extendCmsResource
and holds the Solr implementation ofI_CmsSearchDocument
as member. This enables you to deal with the resulting list as you do with well knownList
and work on it's entries like you do onCmsResource
.What will be done with the Solr search result?
- Although it can happen, that there are less results returned than rows were requested (imagine an index containing less documents than requested rows) we try to guarantee the requested amount of search results and to provide a working pagination with security check.
- To be sure we get enough documents left even the permission check reduces the amount
of found documents, the rows are multiplied by
'5'
and the current page additionally the offset is added. The count of documents we don't have enough permissions for grows with increasing page number, that's why we also multiply the rows by the current page count. - Also make sure we perform the permission check for all found documents, so start with the first found doc.
- Parameters:
cms
- the current OpenCms contextignoreMaxRows
-true
to return all all requested rows,false
to use max rowsquery
- the OpenCms Solr query- Returns:
- the list of found documents
- Throws:
CmsSearchException
- if something goes wrong- See Also:
CmsSolrResultList
,CmsSearchResource
,I_CmsSearchDocument
,CmsSolrQuery
-
search
public CmsSolrResultList search(CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows, CmsResourceFilter filter) throws CmsSearchException
Likesearch(CmsObject, CmsSolrQuery, boolean)
, but additionally a resource filter can be specified. By default, the filter depends on the index.- Parameters:
cms
- the current OpenCms contextignoreMaxRows
-true
to return all all requested rows,false
to use max rowsquery
- the OpenCms Solr queryfilter
- the resource filter to use for post-processing.- Returns:
- the list of documents found.
- Throws:
CmsSearchException
- if something goes wrong
-
search
public CmsSolrResultList search(CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows, javax.servlet.ServletResponse response, boolean ignoreSearchExclude, CmsResourceFilter filter) throws CmsSearchException
Performs the actual search.- Parameters:
cms
- the current OpenCms contextquery
- the OpenCms Solr queryignoreMaxRows
-true
to return all all requested rows,false
to use max rowsresponse
- the servlet response to write the query result to, may also benull
ignoreSearchExclude
- if set to false, only contents with search_exclude unset or "false" will be found - typical for the the non-gallery casefilter
- the resource filter to use- Returns:
- the found documents
- Throws:
CmsSearchException
- if something goes wrong- See Also:
search(CmsObject, CmsSolrQuery, boolean)
-
search
public CmsSolrResultList search(CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows, javax.servlet.ServletResponse response, boolean ignoreSearchExclude, CmsResourceFilter filter, int maxNumResults) throws CmsSearchException
Performs the actual search.To provide for correct permissions two queries are performed and the response is fused from that queries:
- a query for permission checking, where fl, start and rows is adjusted. From this query result we take for the response:
- facets
- spellcheck
- suggester
- morelikethis
- clusters
- a query that collects only the resources determined by the first query and performs highlighting. From this query we take for the response:
- result
- highlighting
- groups
- collapse - representatives of the collapsed group might be filtered by the permission check
- expand is disabled
- Parameters:
cms
- the current OpenCms contextquery
- the OpenCms Solr queryignoreMaxRows
-true
to return all requested rows,false
to use max rowsresponse
- the servlet response to write the query result to, may also benull
ignoreSearchExclude
- if set to false, only contents with search_exclude unset or "false" will be found - typical for the the non-gallery casefilter
- the resource filter to usemaxNumResults
- the maximal number of results to search for- Returns:
- the found documents
- Throws:
CmsSearchException
- if something goes wrong- See Also:
search(CmsObject, CmsSolrQuery, boolean)
- a query for permission checking, where fl, start and rows is adjusted. From this query result we take for the response:
-
search
public CmsSolrResultList search(CmsObject cms, org.apache.solr.client.solrj.SolrQuery query) throws CmsSearchException
Default search method.- Parameters:
cms
- the current CMS objectquery
- the query- Returns:
- the results
- Throws:
CmsSearchException
- if something goes wrong- See Also:
search(CmsObject, String)
-
search
public CmsSolrResultList search(CmsObject cms, java.lang.String solrQuery) throws CmsSearchException
Performs a search.- Parameters:
cms
- the cms objectsolrQuery
- the Solr query- Returns:
- a list of documents
- Throws:
CmsSearchException
- if something goes wrong- See Also:
search(CmsObject, CmsSolrQuery, boolean)
-
select
public void select(javax.servlet.ServletResponse response, CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows) throws java.lang.Exception
Writes the response into the writer.NOTE: Currently not available for HTTP server.
- Parameters:
response
- the servlet responsecms
- the CMS object to use for searchquery
- the Solr queryignoreMaxRows
- if to return unlimited results- Throws:
java.lang.Exception
- if there is no embedded server
-
setName
public void setName(java.lang.String name) throws CmsIllegalArgumentException
Sets the logical key/name of this search index.- Specified by:
setName
in interfaceI_CmsSearchIndex
- Overrides:
setName
in classA_CmsSearchIndex
- Parameters:
name
- the logical key/name of this search index- Throws:
CmsIllegalArgumentException
- if the given name is null, empty or already taken by another search index- See Also:
I_CmsSearchIndex.setName(java.lang.String)
-
setPostProcessor
public void setPostProcessor(I_CmsSolrPostSearchProcessor postProcessor)
Sets the search post processor.- Parameters:
postProcessor
- the search post processor to set
-
setSolrServer
public void setSolrServer(org.apache.solr.client.solrj.SolrClient client)
Sets the Solr server used by this index.- Parameters:
client
- the server to set
-
spellCheck
public void spellCheck(javax.servlet.ServletResponse res, CmsObject cms, CmsSolrQuery q) throws CmsSearchException
Executes a spell checking Solr query and returns the Solr query response.- Parameters:
res
- the servlet responsecms
- the CMS objectq
- the query- Throws:
CmsSearchException
- if something goes wrong
-
createIndexBackup
protected java.lang.String createIndexBackup()
Description copied from class:CmsSearchIndex
Creates a backup of this index for optimized re-indexing of the whole content.- Overrides:
createIndexBackup
in classCmsSearchIndex
- Returns:
- the path to the backup folder, or
null
in case no backup was created - See Also:
CmsSearchIndex.createIndexBackup()
-
hasPermissions
protected boolean hasPermissions(CmsObject cms, CmsSolrDocument doc, CmsResourceFilter filter)
Check, if the current user has permissions on the document's resource.- Parameters:
cms
- the contextdoc
- the solr document (from the search result)filter
- the resource filter to use for checking permissions- Returns:
true
iff the resource mirrored by the search result can be read by the current user.
-
indexSearcherClose
protected void indexSearcherClose()
Description copied from class:CmsSearchIndex
Closes the index searcher for this index.- Overrides:
indexSearcherClose
in classCmsSearchIndex
- See Also:
CmsSearchIndex.indexSearcherClose()
-
indexSearcherOpen
protected void indexSearcherOpen(java.lang.String path)
Description copied from class:CmsSearchIndex
Initializes the index searcher for this index.In case there is an index searcher still open, it is closed first.
For performance reasons, one instance of the index searcher should be kept for all searches. However, if the index is updated or changed this searcher instance needs to be re-initialized.
- Overrides:
indexSearcherOpen
in classCmsSearchIndex
- Parameters:
path
- the path to the index directory- See Also:
CmsSearchIndex.indexSearcherOpen(java.lang.String)
-
indexSearcherUpdate
protected void indexSearcherUpdate()
Description copied from class:CmsSearchIndex
Reopens the index search reader for this index, required after the index has been changed.- Overrides:
indexSearcherUpdate
in classCmsSearchIndex
- See Also:
CmsSearchIndex.indexSearcherUpdate()
-
-