public abstract class LuceneDataSearchEngine extends java.lang.Object implements JcmsConstants
Data
using Lucene.Modifier and Type | Field and Description |
---|---|
protected AlarmManager |
alarmMgr |
protected Channel |
channel |
protected java.lang.String |
directoryName |
static java.lang.String |
ID_FIELD |
protected java.lang.Object |
indexAccessLock |
static java.lang.String |
INDEXING_DATE_EXTRAINFO |
static java.lang.String |
INDEXING_DATE_FIELD |
protected java.util.List<java.lang.String> |
langList
Languages in which the engine index and search its content.
|
protected java.util.Map<java.lang.String,org.apache.lucene.store.FSDirectory> |
langToIndexDirMap
Lucene FSDirectory in which the engine index and search its content.
|
static java.lang.String |
MAX_BUFFERED_DOCS
Optionnal integer property name to define the maxBufferedDocs when writing in lucene index
|
static java.lang.String |
MAX_FIELD_LENGTH
Optionnal integer property name to define the maxFieldLength when writing in lucene index
|
static java.lang.String |
MAX_MERGE_DOCS
Optionnal integer property name to define the maxMergeDocs when writing in lucene index
|
static java.lang.String |
MERGE_FACTOR
Optionnal integer property name to define the mergeFactor when writing in lucene index
|
protected boolean |
multilingual |
static java.lang.String |
REVISION |
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
Modifier | Constructor and Description |
---|---|
protected |
LuceneDataSearchEngine(java.lang.String directoryName,
boolean multilingual)
Construct a new Lucene Data Search Engine given a directory name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addData(Data data)
Add given
Data to this lucene search engine. |
protected void |
addDataCollection(java.util.Collection<? extends Data> coll)
Add given
Collection of Data to this lucene search engine. |
void |
clearIndices()
Delete all
Document from all indices (overwrite existing index with a new one). |
protected void |
clearSearcher()
Close current searchers and clear it for future renewal.
|
protected void |
deleteData(Data data)
Delete given
Data from this lucene search engine. |
protected void |
deleteDataCollection(java.util.Collection<? extends Data> coll)
Delete given
Collection of Data from this lucene search engine. |
protected abstract com.jalios.jcms.search.DataIterator<Data> |
getAllDataIterator()
This methods must be implemented by the LuceneSearchEngine.
|
org.apache.lucene.store.FSDirectory |
getDirectory(java.lang.String lang)
Returns the lucene directory used for the specified language.
|
java.util.Date |
getIndexingDate(Data data)
Retrieve the Date at which the specified Data was indexed in
the main language of the site.
|
java.util.Date |
getIndexingDate(Data data,
java.lang.String lang)
Returns the date at which the specified Data has
been indexed for the specified language.
|
java.util.Date |
getLastOptimizeDateSinceRestart() |
long |
getLastOptimizeDuration() |
java.util.Date |
getLastReindexDateSinceRestart() |
long |
getLastReindexDuration() |
protected abstract org.apache.log4j.Logger |
getLogger()
This methods must be implemented by the LuceneSearchEngine.
|
org.apache.lucene.document.Document |
getLuceneDocument(Data data,
java.lang.String lang)
Returns the lucene Document corresponding to the specified Data
in the index of the the specified language.
|
long |
getOperationStartTime() |
protected org.apache.lucene.index.Term |
getPrimaryTerm(Data data)
Retrieve the a lucene Terme suitable for use as primary key when
searching/removing/updating a unique lucene document for the specified data
|
int |
getProgressState() |
protected org.apache.lucene.search.Searcher |
getSearcher(java.lang.String[] languages)
Retrieve a valid lucene Searcher instance
|
protected void |
index(org.apache.lucene.store.Directory directory,
java.util.Collection<? extends Data> coll,
java.lang.String lang)
Index a
Collection of Data into lucene. |
protected void |
index(org.apache.lucene.store.Directory directory,
java.util.Iterator<? extends Data> iterator,
java.lang.String lang)
Index all
Data returned by the specified Iterator into lucene. |
protected abstract void |
indexData(org.apache.lucene.index.IndexWriter writer,
Data data,
java.lang.String lang)
This methods must be implemented by the LuceneSearchEngine.
|
boolean |
isOperationRunning() |
void |
optimizeIndices()
Optimize all incides of the LuceneSearchEngine.
|
void |
reindexAll()
Clears the lucene indices of this searchengine, reindex all content
retrieved using protected method getAllDataIterator().
|
void |
remove(org.apache.lucene.store.Directory directory,
java.util.Collection<? extends Data> coll)
Remove a
Collection of Data from the lucene index. |
static void |
setIndexWriterOptions(org.apache.lucene.index.IndexWriter writer)
Set IndexWriter options retrieved from hooks and channel properties.
|
protected void |
updateData(Data data)
Update given
Data in this lucene search engine. |
protected void |
updateDataCollection(java.util.Collection<? extends Data> coll)
Update given
Collection of Data in this lucene search engine. |
public static final java.lang.String REVISION
public static final java.lang.String ID_FIELD
public static final java.lang.String INDEXING_DATE_FIELD
public static final java.lang.String INDEXING_DATE_EXTRAINFO
protected final Channel channel
protected final AlarmManager alarmMgr
protected final java.lang.String directoryName
protected final boolean multilingual
protected final java.util.List<java.lang.String> langList
protected final java.util.Map<java.lang.String,org.apache.lucene.store.FSDirectory> langToIndexDirMap
protected final java.lang.Object indexAccessLock
public static final java.lang.String MERGE_FACTOR
public static final java.lang.String MAX_MERGE_DOCS
public static final java.lang.String MAX_BUFFERED_DOCS
public static final java.lang.String MAX_FIELD_LENGTH
protected LuceneDataSearchEngine(java.lang.String directoryName, boolean multilingual) throws java.lang.Exception
directoryName
- the name of the directory to createmultilingual
- true to use one index per language, false to use only one indexjava.lang.Exception
- on any errorpublic static void setIndexWriterOptions(org.apache.lucene.index.IndexWriter writer)
writer
- the IndexWriter for option will be modifiedprotected void index(org.apache.lucene.store.Directory directory, java.util.Collection<? extends Data> coll, java.lang.String lang) throws java.io.IOException
Collection
of Data
into lucene. java.io.IOException
protected void index(org.apache.lucene.store.Directory directory, java.util.Iterator<? extends Data> iterator, java.lang.String lang) throws java.io.IOException
Data
returned by the specified Iterator
into lucene. java.io.IOException
public void remove(org.apache.lucene.store.Directory directory, java.util.Collection<? extends Data> coll) throws java.io.IOException
Collection
of Data
from the lucene index. directory
- The Lucene directory in which to remove the Datascoll
- a collection of Data, must not be nulljava.io.IOException
- if the directory could not be opened or deletion could not be performedprotected org.apache.lucene.index.Term getPrimaryTerm(Data data)
public org.apache.lucene.store.FSDirectory getDirectory(java.lang.String lang)
lang
- the language of JCMS (ISO-639) in which to retrieve the DirectoryFSDirectory
of the specified language or null if no
Directory is available for this language.public org.apache.lucene.document.Document getLuceneDocument(Data data, java.lang.String lang)
data
- the Data being looked forlang
- the language in which to checkpublic java.util.Date getIndexingDate(Data data, java.lang.String lang)
data
- the Data being looked forlang
- the language in which to checkpublic java.util.Date getIndexingDate(Data data)
data
- the Data
for which to retrieve the indexing date.protected void addData(Data data)
Data
to this lucene search engine.
This method is asynchronous, the given data may not be (and will
certainly not be) available immediately after call.protected void updateData(Data data)
Data
in this lucene search engine.
This method is asynchronous, the given data may not be (and will
certainly not be) available immediately after call.protected void deleteData(Data data)
Data
from this lucene search engine.
This method is asynchronous, the given data may not be (and will
certainly not be) available immediately after call.protected void addDataCollection(java.util.Collection<? extends Data> coll)
Collection
of Data
to this lucene search engine.
This method is asynchronous, the given datas may not be (and will
certainly not be) available immediately after call.protected void updateDataCollection(java.util.Collection<? extends Data> coll)
Collection
of Data
in this lucene search engine.
This method is asynchronous, the given datas may not be (and will
certainly not be) available immediately after call.protected void deleteDataCollection(java.util.Collection<? extends Data> coll)
Collection
of Data
from this lucene search engine.
This method is asynchronous, the given datas may not be (and will
certainly not be) available immediately after call.public void clearIndices()
Document
from all indices (overwrite existing index with a new one).
Warning: this operation is undoable!
It is run against the indexing thread, it will not return
as long as the indexing process is not done, and will block the
indexing thread from running when doing its job.public void optimizeIndices()
public java.util.Date getLastOptimizeDateSinceRestart()
public long getLastOptimizeDuration()
public void reindexAll() throws java.io.IOException
isOperationRunning()
and getProgressState()
.java.io.IOException
- if an error occurs during indexingpublic java.util.Date getLastReindexDateSinceRestart()
public long getLastReindexDuration()
protected org.apache.lucene.search.Searcher getSearcher(java.lang.String[] languages) throws java.io.IOException
languages
- The languages for which a searcher must be retrievedjava.io.IOException
protected void clearSearcher()
public boolean isOperationRunning()
getProgressState()
public int getProgressState()
isOperationRunning()
public long getOperationStartTime()
isOperationRunning()
protected abstract org.apache.log4j.Logger getLogger()
Logger
of this engine.protected abstract com.jalios.jcms.search.DataIterator<Data> getAllDataIterator()
reindexAll()
.protected abstract void indexData(org.apache.lucene.index.IndexWriter writer, Data data, java.lang.String lang) throws java.io.IOException
java.io.IOException
Copyright © 2001-2010 Jalios SA. All Rights Reserved.