org.opencms.search
Class CmsSearchIndex

java.lang.Object
  extended by org.opencms.search.CmsSearchIndex
All Implemented Interfaces:
I_CmsConfigurationParameterHandler

public class CmsSearchIndex
extends java.lang.Object
implements I_CmsConfigurationParameterHandler

Implements the search within an index and the management of the index configuration.

Since:
6.0.0
Version:
$Revision: 1.84 $
Author:
Alexander Kandzior, Carsten Weinholz

Nested Class Summary
protected  class CmsSearchIndex.LazyContentReader
          Lucene filter index reader implementation that will ensure the OpenCms default search index fields CmsSearchField.FIELD_CONTENT and CmsSearchField.FIELD_CONTENT_BLOB are lazy loaded.
 
Field Summary
static java.lang.String BACKUP_REINDEXING
          Constant for additional parameter to enable optimized full index regeneration (default: false).
protected static org.apache.lucene.document.FieldSelector CONTENT_SELECTOR
          Field selector for Lucene that that will ensure the OpenCms default search index fields CmsSearchField.FIELD_CONTENT and CmsSearchField.FIELD_CONTENT_BLOB are lazy loaded.
static java.lang.String EXCERPT
          Constant for additional parameter to enable excerpt creation (default: true).
static java.lang.String EXTRACT_CONTENT
          Constant for additional parameter for index content extraction.
static java.lang.String LUCENE_AUTO_COMMIT
          Constant for additional parameter for the Lucene index setting.
static java.lang.String LUCENE_MAX_MERGE_DOCS
          Constant for additional parameter for the Lucene index setting.
static java.lang.String LUCENE_MERGE_FACTOR
          Constant for additional parameter for the Lucene index setting.
static java.lang.String LUCENE_RAM_BUFFER_SIZE_MB
          Constant for additional parameter for the Lucene index setting.
static java.lang.String LUCENE_USE_COMPOUND_FILE
          Constant for additional parameter for the Lucene index setting.
protected  java.util.List<CmsSearchIndexSource> m_sources
          The list of configured index sources.
static java.lang.String MAX_HITS
          Constant for additional parameter for controlling how many hits are loaded at maximum (default: 1000).
static int MAX_HITS_DEFAULT
          Indicates how many hits are loaded at maximum by default.
static java.lang.String PERMISSIONS
          Constant for additional parameter to enable permission checks (default: true).
static java.lang.String PRIORITY
          Constant for additional parameter to set the thread priority during search.
static java.lang.String REBUILD_MODE_AUTO
          Automatic ("auto") index rebuild mode.
static java.lang.String REBUILD_MODE_MANUAL
          Manual ("manual") index rebuild mode.
static java.lang.String REBUILD_MODE_OFFLINE
          Offline ("offline") index rebuild mode.
static java.lang.String TIME_RANGE
          Constant for additional parameter to enable time range checks (default: true).
 
Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
 
Constructor Summary
CmsSearchIndex()
          Default constructor only intended to be used by the XML configuration.
CmsSearchIndex(java.lang.String name)
          Creates a new CmsSearchIndex with the given name.
 
Method Summary
 void addConfigurationParameter(java.lang.String key, java.lang.String value)
          Adds a parameter.
 void addSourceName(java.lang.String sourceName)
          Adds am index source to this search index.
 boolean checkConfiguration(CmsObject cms)
          Checks is this index has been configured correctly.
protected  java.lang.String createIndexBackup()
          Creates a backup of this index for optimized re-indexing of the whole content.
 boolean equals(java.lang.Object obj)
           
protected  void extendPathFilter(org.apache.lucene.search.TermsFilter pathFilter, java.lang.String searchRoot)
          Extends the given path query with another term for the given search root element.
 org.apache.lucene.analysis.Analyzer getAnalyzer()
          Returns the Lucene analyzer used for this index.
 java.util.Map<java.lang.String,java.lang.Object> getConfiguration()
          Returns the configuration of this parameter configurable class instance, or null if the class does not need to be configured.
 org.apache.lucene.document.Document getDocument(java.lang.String rootPath)
          Returns the Lucene document with the given root path from the index.
 I_CmsDocumentFactory getDocumentFactory(CmsResource res)
          Returns the document type factory used for the given resource in this index, or null in case the resource is not indexed by this index.
 CmsSearchFieldConfiguration getFieldConfiguration()
          Returns the search field configuration of this index.
 java.lang.String getFieldConfigurationName()
          Returns the name of the field configuration used for this index.
 org.apache.lucene.index.IndexWriter getIndexWriter(boolean create)
          Returns a new index writer for this index.
 java.util.Locale getLocale()
          Returns the language locale of this index.
 java.lang.String getLocaleString()
          Returns the language locale of the index as a String.
 int getMaxHits()
          Indicates the number of how many hits are loaded at maximum.
protected  org.apache.lucene.search.Filter getMultiTermQueryFilter(java.lang.String field, java.util.List<java.lang.String> terms)
          Returns a cached Lucene term query filter for the given field and terms.
protected  org.apache.lucene.search.Filter getMultiTermQueryFilter(java.lang.String field, java.lang.String terms)
          Returns a cached Lucene term query filter for the given field and terms.
protected  org.apache.lucene.search.Filter getMultiTermQueryFilter(java.lang.String field, java.lang.String termsStr, java.util.List<java.lang.String> termsList)
          Returns a cached Lucene term query filter for the given field and terms.
 java.lang.String getName()
          Gets the name of this index.
 java.lang.String getPath()
          Returns the path where this index stores it's data in the "real" file system.
 int getPriority()
          Returns the Thread priority for this search index.
 java.lang.String getProject()
          Gets the project of this index.
 java.lang.String getRebuildMode()
          Get the rebuild mode of this index.
 org.apache.lucene.search.IndexSearcher getSearcher()
          Returns the Lucene index searcher used for this search index.
 java.util.List<java.lang.String> getSourceNames()
          Returns all configured sources names of this search index.
 java.util.List<CmsSearchIndexSource> getSources()
          Returns all configured index sources of this search index.
protected  org.apache.lucene.search.Filter getTermQueryFilter(java.lang.String field, java.lang.String term)
          Returns a cached Lucene term query filter for the given field and term.
 int hashCode()
           
protected  boolean hasReadPermission(CmsObject cms, org.apache.lucene.document.Document doc)
          Checks if the OpenCms resource referenced by the result document can be read be the user of the given OpenCms context.
protected  void indexSearcherClose()
          Closes the Lucene index searcher for this index.
protected  void indexSearcherOpen(java.lang.String path)
          Initializes the Lucene index searcher for this index.
 void initConfiguration()
          Initializes a configuration after all parameters have been added.
 void initialize()
          Initializes the search index.
 boolean isBackupReindexing()
          Returns true if backup re-indexing is done by this index.
 boolean isCheckingPermissions()
          Returns true if permissions are checked for search results by this index.
 boolean isCheckingTimeRange()
          Returns true if the document time range is checked for search results by this index.
 boolean isCreatingExcerpt()
          Returns true if an excerpt is generated by this index.
 boolean isEnabled()
          Returns true if this index is currently disabled.
 boolean isExtractingContent()
          Returns true if full text is extracted by this index.
protected  boolean isInTimeRange(org.apache.lucene.document.Document doc, CmsSearchParameters params)
          Checks if the document is in the time range specified in the search parameters.
protected  void removeIndexBackup(java.lang.String path)
          Removes the given backup folder of this index.
 void removeSourceName(java.lang.String sourceName)
          Removes an index source from this search index.
 CmsSearchResultList search(CmsObject cms, CmsSearchParameters params)
          Performs a search on the index within the given fields.
 void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
          Sets the Lucene analyzer used for this index.
 void setEnabled(boolean enabled)
          Can be used to enable / disable this index.
 void setFieldConfiguration(CmsSearchFieldConfiguration fieldConfiguration)
          Sets the field configuration used for this index.
 void setFieldConfigurationName(java.lang.String fieldConfigurationName)
          Sets the name of the field configuration used for this index.
 void setLocale(java.util.Locale locale)
          Sets the locale to index resources.
 void setLocaleString(java.lang.String locale)
          Sets the locale to index resources as a String.
 void setMaxHits(int maxHits)
          Sets the number of how many hits are loaded at maximum.
 void setName(java.lang.String name)
          Sets the logical key/name of this search index.
 void setProject(java.lang.String projectName)
          Sets the name of the project used to index resources.
 void setProjectName(java.lang.String projectName)
          Sets the name of the project used to index resources.
 void setRebuildMode(java.lang.String rebuildMode)
          Sets the rebuild mode of this search index.
 void shutDown()
          Shuts down the search index.
 java.lang.String toString()
          Returns the name (getName()) of this search index.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BACKUP_REINDEXING

public static final java.lang.String BACKUP_REINDEXING
Constant for additional parameter to enable optimized full index regeneration (default: false).


EXCERPT

public static final java.lang.String EXCERPT
Constant for additional parameter to enable excerpt creation (default: true).


EXTRACT_CONTENT

public static final java.lang.String EXTRACT_CONTENT
Constant for additional parameter for index content extraction.


LUCENE_AUTO_COMMIT

public static final java.lang.String LUCENE_AUTO_COMMIT
Constant for additional parameter for the Lucene index setting.

See Also:
Constant Field Values

LUCENE_MAX_MERGE_DOCS

public static final java.lang.String LUCENE_MAX_MERGE_DOCS
Constant for additional parameter for the Lucene index setting.

See Also:
Constant Field Values

LUCENE_MERGE_FACTOR

public static final java.lang.String LUCENE_MERGE_FACTOR
Constant for additional parameter for the Lucene index setting.

See Also:
Constant Field Values

LUCENE_RAM_BUFFER_SIZE_MB

public static final java.lang.String LUCENE_RAM_BUFFER_SIZE_MB
Constant for additional parameter for the Lucene index setting.

See Also:
Constant Field Values

LUCENE_USE_COMPOUND_FILE

public static final java.lang.String LUCENE_USE_COMPOUND_FILE
Constant for additional parameter for the Lucene index setting.

See Also:
Constant Field Values

MAX_HITS

public static final java.lang.String MAX_HITS
Constant for additional parameter for controlling how many hits are loaded at maximum (default: 1000).


MAX_HITS_DEFAULT

public static final int MAX_HITS_DEFAULT
Indicates how many hits are loaded at maximum by default.

See Also:
Constant Field Values

PERMISSIONS

public static final java.lang.String PERMISSIONS
Constant for additional parameter to enable permission checks (default: true).


PRIORITY

public static final java.lang.String PRIORITY
Constant for additional parameter to set the thread priority during search.


REBUILD_MODE_AUTO

public static final java.lang.String REBUILD_MODE_AUTO
Automatic ("auto") index rebuild mode.

See Also:
Constant Field Values

REBUILD_MODE_MANUAL

public static final java.lang.String REBUILD_MODE_MANUAL
Manual ("manual") index rebuild mode.

See Also:
Constant Field Values

REBUILD_MODE_OFFLINE

public static final java.lang.String REBUILD_MODE_OFFLINE
Offline ("offline") index rebuild mode.

See Also:
Constant Field Values

TIME_RANGE

public static final java.lang.String TIME_RANGE
Constant for additional parameter to enable time range checks (default: true).


CONTENT_SELECTOR

protected static final org.apache.lucene.document.FieldSelector CONTENT_SELECTOR
Field selector for Lucene that that will ensure the OpenCms default search index fields CmsSearchField.FIELD_CONTENT and CmsSearchField.FIELD_CONTENT_BLOB are lazy loaded.

This is to optimize performance - these 2 fields will be rather large especially for extracted binary documents like PDF, MS Office etc. By using lazy fields the data is only read when it is actually used.


m_sources

protected java.util.List<CmsSearchIndexSource> m_sources
The list of configured index sources.

Constructor Detail

CmsSearchIndex

public CmsSearchIndex()
Default constructor only intended to be used by the XML configuration.

It is recommended to use the constructor CmsSearchIndex(String) as it enforces the mandatory name argument.


CmsSearchIndex

public CmsSearchIndex(java.lang.String name)
               throws CmsIllegalArgumentException
Creates a new CmsSearchIndex with the given name.

Parameters:
name - the system-wide unique name for the search index
Throws:
CmsIllegalArgumentException - if the given name is null, empty or already taken by another search index
Method Detail

addConfigurationParameter

public void addConfigurationParameter(java.lang.String key,
                                      java.lang.String value)
Adds a parameter.

Specified by:
addConfigurationParameter in interface I_CmsConfigurationParameterHandler
Parameters:
key - the key/name of the parameter
value - the value of the parameter

addSourceName

public void addSourceName(java.lang.String sourceName)
Adds am index source to this search index.

Parameters:
sourceName - the index source name to add

checkConfiguration

public boolean checkConfiguration(CmsObject cms)
Checks is this index has been configured correctly.

In case the check fails, the enabled property is set to false

Parameters:
cms - a OpenCms user context to perform the checks with (should have "Administrator" permissions)
Returns:
true in case the index is correctly configured and enabled after the check
See Also:
isEnabled()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getAnalyzer

public org.apache.lucene.analysis.Analyzer getAnalyzer()
Returns the Lucene analyzer used for this index.

Returns:
the Lucene analyzer used for this index

getConfiguration

public java.util.Map<java.lang.String,java.lang.Object> getConfiguration()
Description copied from interface: I_CmsConfigurationParameterHandler
Returns the configuration of this parameter configurable class instance, or null if the class does not need to be configured.

All elements in the configuration are key, value String pairs, set using the I_CmsConfigurationParameterHandler.addConfigurationParameter(String, String) method during initialization of the loader.

Implementations will (should) not to return a direct reference to the internal configuration but just a copy of it, to avoid unwanted external manipulation.

Specified by:
getConfiguration in interface I_CmsConfigurationParameterHandler
Returns:
the configuration of this resource loader, or null
See Also:
I_CmsConfigurationParameterHandler.getConfiguration()

getDocument

public org.apache.lucene.document.Document getDocument(java.lang.String rootPath)
Returns the Lucene document with the given root path from the index.

Parameters:
rootPath - the root path of the document to get
Returns:
the Lucene document with the given root path from the index

getDocumentFactory

public I_CmsDocumentFactory getDocumentFactory(CmsResource res)
Returns the document type factory used for the given resource in this index, or null in case the resource is not indexed by this index.

A resource is indexed if the following is all true:

  1. The index contains at last one index source matching the root path of the given resource.
  2. For this matching index source, the document type factory needed by the resource is also configured.

Parameters:
res - the resource to check
Returns:
he document type factory used for the given resource in this index, or null in case the resource is not indexed by this index

getFieldConfiguration

public CmsSearchFieldConfiguration getFieldConfiguration()
Returns the search field configuration of this index.

Returns:
the search field configuration of this index

getFieldConfigurationName

public java.lang.String getFieldConfigurationName()
Returns the name of the field configuration used for this index.

Returns:
the name of the field configuration used for this index

getIndexWriter

public org.apache.lucene.index.IndexWriter getIndexWriter(boolean create)
                                                   throws CmsIndexException
Returns a new index writer for this index.

Parameters:
create - if true a whole new index is created, if false an existing index is updated
Returns:
a new instance of IndexWriter
Throws:
CmsIndexException - if the index can not be opened

getLocale

public java.util.Locale getLocale()
Returns the language locale of this index.

Returns:
the language locale of this index, for example "en"

getLocaleString

public java.lang.String getLocaleString()
Returns the language locale of the index as a String.

Returns:
the language locale of the index as a String
See Also:
getLocale()

getMaxHits

public int getMaxHits()
Indicates the number of how many hits are loaded at maximum.

Since Lucene 2.4, the number of maximum documents to load from the index must be specified. The default of this setting is MAX_HITS_DEFAULT (5000). This means that at maximum 5000 results are returned from the index. Please note that this number may be reduced further because of OpenCms read permissions or per-user file visibility settings not controlled in the index.

Returns:
the number of how many hits are loaded at maximum
Since:
7.5.1

getName

public java.lang.String getName()
Gets the name of this index.

Returns:
the name of the index

getPath

public java.lang.String getPath()
Returns the path where this index stores it's data in the "real" file system.

Returns:
the path where this index stores it's data in the "real" file system

getPriority

public int getPriority()
Returns the Thread priority for this search index.

Returns:
the Thread priority for this search index

getProject

public java.lang.String getProject()
Gets the project of this index.

Returns:
the project of the index, i.e. "online"

getRebuildMode

public java.lang.String getRebuildMode()
Get the rebuild mode of this index.

Returns:
the current rebuild mode

getSearcher

public org.apache.lucene.search.IndexSearcher getSearcher()
Returns the Lucene index searcher used for this search index.

Returns:
the Lucene index searcher used for this search index

getSourceNames

public java.util.List<java.lang.String> getSourceNames()
Returns all configured sources names of this search index.

Returns:
a list with all configured sources names of this search index

getSources

public java.util.List<CmsSearchIndexSource> getSources()
Returns all configured index sources of this search index.

Returns:
all configured index sources of this search index

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

initConfiguration

public void initConfiguration()
Description copied from interface: I_CmsConfigurationParameterHandler
Initializes a configuration after all parameters have been added.

Specified by:
initConfiguration in interface I_CmsConfigurationParameterHandler
See Also:
I_CmsConfigurationParameterHandler.initConfiguration()

initialize

public void initialize()
                throws CmsSearchException
Initializes the search index.

Throws:
CmsSearchException - if the index source association failed

isBackupReindexing

public boolean isBackupReindexing()
Returns true if backup re-indexing is done by this index.

This is an optimization method by which the old extracted content is reused in order to save performance when re-indexing.

Returns:
true if backup re-indexing is done by this index
Since:
7.5.1

isCheckingPermissions

public boolean isCheckingPermissions()
Returns true if permissions are checked for search results by this index.

If permission checks are not required, they can be turned off in the index search configuration parameters in opencms-search.xml. Not checking permissions will improve performance.

This is can be of use in scenarios when you know that all search results are always readable, which is usually true for public websites that do not have personalized accounts.

Please note that even if a result is returned where the current user has no read permissions, the user can not actually access this document. It will only appear in the search result list, but if the user clicks the link to open the document he will get an error.

Returns:
true if permissions are checked for search results by this index

isCheckingTimeRange

public boolean isCheckingTimeRange()
Returns true if the document time range is checked for search results by this index.

If time range checks are not required, they can be turned off in the index search configuration parameters in opencms-search.xml. Not checking the time range will improve performance.

Returns:
true if the document time range is checked for search results by this index

isCreatingExcerpt

public boolean isCreatingExcerpt()
Returns true if an excerpt is generated by this index.

If no except is required, generation can be turned off in the index search configuration parameters in opencms-search.xml. Not generating an excerpt will improve performance.

Returns:
true if an excerpt is generated by this index

isEnabled

public boolean isEnabled()
Returns true if this index is currently disabled.

Returns:
true if this index is currently disabled

isExtractingContent

public boolean isExtractingContent()
Returns true if full text is extracted by this index.

Full text content extraction can be turned off in the index search configuration parameters in opencms-search.xml. Not extraction the full text information will highly improve performance.

Returns:
true if full text is extracted by this index

removeSourceName

public void removeSourceName(java.lang.String sourceName)
Removes an index source from this search index.

Parameters:
sourceName - the index source name to remove

search

public CmsSearchResultList search(CmsObject cms,
                                  CmsSearchParameters params)
                           throws CmsSearchException
Performs a search on the index within the given fields.

The result is returned as List with entries of type I_CmsSearchResult.

Parameters:
cms - the current user's Cms object
params - the parameters to use for the search
Returns:
the List of results found or an empty list
Throws:
CmsSearchException - if something goes wrong

setAnalyzer

public void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
Sets the Lucene analyzer used for this index.

Parameters:
analyzer - the Lucene analyzer to set

setEnabled

public void setEnabled(boolean enabled)
Can be used to enable / disable this index.

Parameters:
enabled - the state of the index to set

setFieldConfiguration

public void setFieldConfiguration(CmsSearchFieldConfiguration fieldConfiguration)
Sets the field configuration used for this index.

Parameters:
fieldConfiguration - the field configuration to set

setFieldConfigurationName

public void setFieldConfigurationName(java.lang.String fieldConfigurationName)
Sets the name of the field configuration used for this index.

Parameters:
fieldConfigurationName - the name of the field configuration to set

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale to index resources.

Parameters:
locale - the locale to index resources

setLocaleString

public void setLocaleString(java.lang.String locale)
Sets the locale to index resources as a String.

Parameters:
locale - the locale to index resources
See Also:
setLocale(Locale)

setMaxHits

public void setMaxHits(int maxHits)
Sets the number of how many hits are loaded at maximum.

This must be set at least to 50, or this setting is ignored.

Parameters:
maxHits - the number of how many hits are loaded at maximum to set
Since:
7.5.1
See Also:
getMaxHits()

setName

public void setName(java.lang.String name)
             throws CmsIllegalArgumentException
Sets the logical key/name of this search index.

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

setProject

public void setProject(java.lang.String projectName)
Sets the name of the project used to index resources.

A duplicate method of setProjectName(String) that allows to use instances of this class as a widget object (bean convention, cp.: getProject().

Parameters:
projectName - the name of the project used to index resources

setProjectName

public void setProjectName(java.lang.String projectName)
Sets the name of the project used to index resources.

Parameters:
projectName - the name of the project used to index resources

setRebuildMode

public void setRebuildMode(java.lang.String rebuildMode)
Sets the rebuild mode of this search index.

Parameters:
rebuildMode - the rebuild mode of this search index {auto|manual}

shutDown

public void shutDown()
              throws java.io.IOException
Shuts down the search index.

This will close the local Lucene index searcher instance.

Throws:
java.io.IOException - in case the index could not be closed

toString

public java.lang.String toString()
Returns the name (getName()) of this search index.

Overrides:
toString in class java.lang.Object
Returns:
the name (getName()) of this search index
See Also:
Object.toString()

createIndexBackup

protected java.lang.String createIndexBackup()
Creates a backup of this index for optimized re-indexing of the whole content.

Returns:
the path to the backup folder, or null in case no backup was created

extendPathFilter

protected void extendPathFilter(org.apache.lucene.search.TermsFilter pathFilter,
                                java.lang.String searchRoot)
Extends the given path query with another term for the given search root element.

Parameters:
pathFilter - the path filter to extend
searchRoot - the search root to add to the path query

getMultiTermQueryFilter

protected org.apache.lucene.search.Filter getMultiTermQueryFilter(java.lang.String field,
                                                                  java.util.List<java.lang.String> terms)
Returns a cached Lucene term query filter for the given field and terms.

Parameters:
field - the field to use
terms - the term to use
Returns:
a cached Lucene term query filter for the given field and terms

getMultiTermQueryFilter

protected org.apache.lucene.search.Filter getMultiTermQueryFilter(java.lang.String field,
                                                                  java.lang.String terms)
Returns a cached Lucene term query filter for the given field and terms.

Parameters:
field - the field to use
terms - the term to use
Returns:
a cached Lucene term query filter for the given field and terms

getMultiTermQueryFilter

protected org.apache.lucene.search.Filter getMultiTermQueryFilter(java.lang.String field,
                                                                  java.lang.String termsStr,
                                                                  java.util.List<java.lang.String> termsList)
Returns a cached Lucene term query filter for the given field and terms.

Parameters:
field - the field to use
termsStr - the terms to use as a String separated by a space ' ' char
termsList - the list of terms to use
Returns:
a cached Lucene term query filter for the given field and terms

getTermQueryFilter

protected org.apache.lucene.search.Filter getTermQueryFilter(java.lang.String field,
                                                             java.lang.String term)
Returns a cached Lucene term query filter for the given field and term.

Parameters:
field - the field to use
term - the term to use
Returns:
a cached Lucene term query filter for the given field and term

hasReadPermission

protected boolean hasReadPermission(CmsObject cms,
                                    org.apache.lucene.document.Document doc)
Checks if the OpenCms resource referenced by the result document can be read be the user of the given OpenCms context.

Parameters:
cms - the OpenCms user context to use for permission testing
doc - the search result document to check
Returns:
true if the user has read permissions to the resource

indexSearcherClose

protected void indexSearcherClose()
Closes the Lucene index searcher for this index.

See Also:
indexSearcherOpen(String)

indexSearcherOpen

protected void indexSearcherOpen(java.lang.String path)
Initializes the Lucene index searcher for this index.

Use getSearcher() in order to obtain the searcher that has been opened.

In case there is an index searcher still open, it is closed first.

For performance reasons, one instance of the Lucene index searcher should be kept for all searches. However, if the index is updated or changed this searcher instance needs to be re-initialized.

Parameters:
path - the path to the index directory

isInTimeRange

protected boolean isInTimeRange(org.apache.lucene.document.Document doc,
                                CmsSearchParameters params)
Checks if the document is in the time range specified in the search parameters.

The creation date and/or the last modification date are checked.

Parameters:
doc - the document to check the dates against the given time range
params - the search parameters where the time ranges are specified
Returns:
true if document is in time range or not time range set otherwise false

removeIndexBackup

protected void removeIndexBackup(java.lang.String path)
Removes the given backup folder of this index.

Parameters:
path - the backup folder to remove
See Also:
isBackupReindexing()