|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.search.LuceneDataSearchEngine
public abstract class LuceneDataSearchEngine
This class provides a base class to index JCMS Data
using Lucene.
Nested Class Summary | |
---|---|
class |
LuceneDataSearchEngine.MultiSearcherWrapper
|
Field Summary | |
---|---|
protected AlarmManager |
alarmMgr
|
protected Channel |
channel
|
protected String |
directoryName
|
protected static String |
ID_FIELD
|
protected Object |
indexAccessLock
|
protected static String |
INDEXING_DATE_EXTRAINFO
|
protected static String |
INDEXING_DATE_FIELD
|
protected List<String> |
langList
|
protected Map<String,org.apache.lucene.store.Directory> |
langToIndexDirMap
|
static String |
MAX_BUFFERED_DOCS
Optionnal integer property name to define the maxBufferedDocs when writing in lucene index |
static String |
MAX_FIELD_LENGTH
Optionnal integer property name to define the maxFieldLength when writing in lucene index |
static String |
MAX_MERGE_DOCS
Optionnal integer property name to define the maxMergeDocs when writing in lucene index |
static String |
MERGE_FACTOR
Optionnal integer property name to define the mergeFactor when writing in lucene index |
static String |
REVISION
|
Fields inherited from interface com.jalios.util.JaliosConstants |
---|
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 |
Constructor Summary | |
---|---|
protected |
LuceneDataSearchEngine(String directoryName)
Construct a new Lucene Data Search Engine given a directory name. |
Method Summary | |
---|---|
protected void |
addData(Data data)
Add given Data to this lucene search engine. |
protected void |
addDataCollection(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 |
deleteData(Data data)
Delete given Data from this lucene search engine. |
protected void |
deleteDataCollection(Collection<? extends Data> coll)
Delete given Collection of Data from this lucene search engine. |
protected abstract com.jalios.jcms.search.LuceneDataSearchEngine.DataIterator<Data> |
getAllDataIterator()
This methods must be implemented by the LuceneSearchEngine. |
org.apache.lucene.store.FSDirectory |
getDirectory(String lang)
Returns the lucene directory used for the specified language. |
Date |
getIndexingDate(Data data)
Retrieve the Date at which the specified Data was indexed in the main language of the site. |
Date |
getIndexingDate(Data data,
String lang)
Returns the date at which the specified Data has been indexed for the specified language. |
Date |
getLastOptimizeDateSinceRestart()
|
long |
getLastOptimizeDuration()
|
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,
String lang)
Returns the lucene Document corresponding to the specified Data in the index of the the specified language. |
long |
getOperationStartTime()
|
int |
getProgressState()
|
protected org.apache.lucene.search.Searcher |
getSearcher()
|
protected void |
index(org.apache.lucene.store.Directory directory,
Collection<? extends Data> coll,
String lang)
Index a Collection of Data into lucene. |
protected void |
index(org.apache.lucene.store.Directory directory,
Iterator<? extends Data> iterator,
String lang)
Index all Data returned by the specified Iterator into lucene. |
protected abstract void |
indexData(org.apache.lucene.index.IndexWriter writer,
Data data,
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,
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(Collection<? extends Data> coll)
Update given Collection of Data in this lucene search engine. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
protected static final String ID_FIELD
protected static final String INDEXING_DATE_FIELD
protected static final String INDEXING_DATE_EXTRAINFO
protected final Channel channel
protected final AlarmManager alarmMgr
protected final List<String> langList
protected final String directoryName
protected final Map<String,org.apache.lucene.store.Directory> langToIndexDirMap
protected final Object indexAccessLock
public static final String MERGE_FACTOR
public static final String MAX_MERGE_DOCS
public static final String MAX_BUFFERED_DOCS
public static final String MAX_FIELD_LENGTH
Constructor Detail |
---|
protected LuceneDataSearchEngine(String directoryName) throws Exception
directoryName
- the name of the directory to create
Exception
- on any errorMethod Detail |
---|
public 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, Collection<? extends Data> coll, String lang) throws IOException
Collection
of Data
into lucene.
IOException
protected void index(org.apache.lucene.store.Directory directory, Iterator<? extends Data> iterator, String lang) throws IOException
Data
returned by the specified Iterator
into lucene.
IOException
public void remove(org.apache.lucene.store.Directory directory, Collection<? extends Data> coll) throws IOException
Collection
of Data
from the lucene index.
IOException
public org.apache.lucene.store.FSDirectory getDirectory(String lang)
lang
- the language of JCMS (ISO-639) in which to retrieve the Directory
FSDirectory
of the specified language or null if no
Directory is available for this language.public org.apache.lucene.document.Document getLuceneDocument(Data data, String lang)
data
- the Data being looked forlang
- the language in which to check
public Date getIndexingDate(Data data, String lang)
data
- the Data being looked forlang
- the language in which to check
public 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(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(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(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 Date getLastOptimizeDateSinceRestart()
public long getLastOptimizeDuration()
public void reindexAll() throws IOException
isOperationRunning()
and getProgressState()
.
IOException
- if an error occurs during indexingpublic Date getLastReindexDateSinceRestart()
public long getLastReindexDuration()
protected org.apache.lucene.search.Searcher getSearcher() throws IOException
IOException
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.LuceneDataSearchEngine.DataIterator<Data> getAllDataIterator()
reindexAll()
.
protected abstract void indexData(org.apache.lucene.index.IndexWriter writer, Data data, String lang) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |