public class LucenePublicationSearchEngine extends LuceneDataSearchEngine implements PublicationSearchEngine, JcmsConstants
PublicationSearchEngine
is reponsible for the indexing and searching of JCMS
content using lucene. WEB-INF/data/lucene/PublicationsIndices/<lang>/
.Document
per indexed Publication
.ALLFIELDS_FIELD
used for searching."search-engine.optimize-schedule"
(jdring's AlarmEntry cron-like format)Analyzer getAnalyzer(String lang);
LuceneDataSearchEngine.IndexingLatch
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ABSTRACT_FIELD |
static java.lang.String |
ADATE_FIELD |
static java.lang.String |
ALLFIELDS_FIELD |
static java.lang.String |
AUTHORID_FIELD |
static java.lang.String |
CDATE_FIELD |
static java.text.DateFormat |
dateFormatter |
static java.lang.String |
EDATE_FIELD |
static java.lang.String |
FILEDOCUMENT_CONTENT_TYPE_FIELD |
static java.lang.String |
FILEDOCUMENT_FILE_EXTENSION_FIELD |
static java.lang.String |
FILEDOCUMENT_FILENAME_FIELD |
static java.lang.String |
FILEDOCUMENT_ORIGINAL_FILENAME_FIELD |
protected static long |
HITS_TIMEOUT |
static java.lang.String |
HITS_TIMEOUT_PROP |
static java.lang.String |
LUCENE_ADVANCED_QUERY_ATTRIBUTE
QueryHandler attribute name for the optionnal advanced lucene query that
can be performed with this Engine.
|
static java.lang.String |
LUCENE_CUSTOM_QUERY_ATTRIBUTE
QueryHandler attribute name for the optionnal advanced lucene query that
can be performed with this Engine.
|
static java.lang.String |
PDATE_FIELD |
static java.lang.String |
PSTATUS_FIELD |
protected static java.lang.String |
PUBLICATION_INDEX_DIRECTORY |
static java.lang.String |
REVISION |
static java.lang.String |
SDATE_FIELD |
static java.lang.String |
SPELLSUGGEST_ATTRIBUTE
This variable is the attribute's key used by the LucenePublicationSearchEngine to
set the suggested search string in the QueryResultSet Attribute.
|
protected SpellSuggestEngine |
spellSuggestEngine |
static java.lang.String |
TITLE_FIELD |
static java.lang.String |
VERSION_FIELD |
static java.lang.String |
WORKSPACEID_FIELD |
alarmMgr, channel, directoryName, ID_FIELD, indexAccessLock, INDEXING_DATE_EXTRAINFO, INDEXING_DATE_FIELD, langList, langToIndexDirMap, MAX_BUFFERED_DOCS, MAX_FIELD_LENGTH, MAX_MERGE_DOCS, MERGE_FACTOR, multilingual
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
Constructor and Description |
---|
LucenePublicationSearchEngine()
Initialize the Lucene Search Engine
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.Collection<? extends Publication> coll)
Add given
Collection of Publication to this lucene search engine. |
void |
add(Publication pub)
Add given
Publication to this lucene search engine. |
void |
addKeywordField(org.apache.lucene.document.Document doc,
Publication pub,
java.lang.String lang,
java.lang.String fieldName,
java.lang.String fieldValue)
This methods create a unstored Lucene
Field with the given field's value
of the given Publication in the given language, and add into the given Document . |
void |
addRawField(org.apache.lucene.document.Document doc,
Publication pub,
java.lang.String lang,
java.lang.String fieldName,
java.lang.String fieldValue)
This methods create a unstored and untokenized Lucene
Field with the given field's value
of the given Publication in the given language, and add into the given Document . |
void |
addStoredField(org.apache.lucene.document.Document doc,
Publication pub,
java.lang.String lang,
java.lang.String fieldName,
java.lang.String fieldValue)
This methods create a stored Lucene
Field with the given field's value
of the given Publication in the given language, and add into the given Document . |
void |
addUnStoredField(org.apache.lucene.document.Document doc,
Publication pub,
java.lang.String lang,
java.lang.String fieldName,
java.lang.String fieldValue)
This methods create a unstored Lucene
Field with the given field's value
of the given Publication in the given language, and add into the given Document . |
void |
clearAll()
Clear indices in this searchEngine (undoable!).
|
void |
delete(java.util.Collection<? extends Publication> coll)
Delete given
Collection of Publication from this lucene search engine. |
void |
delete(Publication pub)
Delete given
Publication from this lucene search engine. |
protected com.jalios.jcms.search.DataIterator<Data> |
getAllDataIterator()
This methods must be implemented by the LuceneSearchEngine.
|
java.util.Date |
getIndexingDate(Publication pub)
Retrieve the Date at which the specified Publication was indexed in the search engine.
|
protected org.apache.log4j.Logger |
getLogger()
This methods must be implemented by the LuceneSearchEngine.
|
SpellSuggestEngine |
getSpellSuggestEngine() |
static boolean |
hasAdvancedLuceneQuery(QueryHandler qh)
Check if an advanced lucene query has been specified in the QueryHandler attribute of the specified QueryHandler.
|
protected void |
indexData(org.apache.lucene.index.IndexWriter writer,
Data data,
java.lang.String lang)
This methods index the given publication in the given language, into the given index writer.
|
java.util.LinkedHashMap<java.lang.String,java.lang.Float> |
search(QueryHandler qh)
Return the list of publication's identifier with a lucene search.
|
boolean |
search(QueryHandler qh,
java.util.HashSet<? extends Publication> pubSet,
QueryResultSet resultSet)
Search
Publication using lucene search engine. |
java.util.LinkedHashMap<java.lang.String,java.lang.Float> |
search(QueryHandler qh,
java.util.List<java.lang.String> idList)
Filters the given list of publication's identifier with a lucene search.
|
void |
update(java.util.Collection<? extends Publication> coll)
Update given
Collection of Publication in this lucene search engine. |
void |
update(Publication pub)
Update given
Publication in this lucene search engine. |
addData, addDataCollection, clearIndices, clearSearcher, deleteData, deleteDataCollection, getDirectory, getIndexingDate, getIndexingDate, getIndexingLatch, getLastOptimizeDateSinceRestart, getLastOptimizeDuration, getLastReindexDateSinceRestart, getLastReindexDuration, getLuceneDocument, getOperationStartTime, getPrimaryTerm, getProgressState, getSearcher, index, index, isOperationRunning, optimizeIndices, reindexAll, remove, setIndexWriterOptions, updateData, updateDataCollection
public static final java.lang.String REVISION
public static final java.lang.String SPELLSUGGEST_ATTRIBUTE
public static final java.lang.String LUCENE_ADVANCED_QUERY_ATTRIBUTE
Example to require a custom field :
QueryHandler qh = new QueryHandler(); //qh.set(...) qh.setAttribute(LUCENE_ADVANCED_QUERY_ATTRIBUTE, "+myField:somevalue"); QueryResultSet qrs = qh.getResultSet();
public static final java.lang.String LUCENE_CUSTOM_QUERY_ATTRIBUTE
Example to require a custom field :
QueryHandler qh = new QueryHandler(); //qh.set(...) qh.setAttribute(LUCENE_CUSTOM_QUERY_ATTRIBUTE, new BooleanQuery(...)); QueryResultSet qrs = qh.getResultSet();
protected static final java.lang.String PUBLICATION_INDEX_DIRECTORY
public static final java.lang.String TITLE_FIELD
public static final java.lang.String ABSTRACT_FIELD
public static final java.lang.String ALLFIELDS_FIELD
public static final java.lang.String AUTHORID_FIELD
public static final java.lang.String PSTATUS_FIELD
public static final java.lang.String WORKSPACEID_FIELD
public static final java.lang.String CDATE_FIELD
public static final java.lang.String PDATE_FIELD
public static final java.lang.String SDATE_FIELD
public static final java.lang.String EDATE_FIELD
public static final java.lang.String ADATE_FIELD
public static final java.lang.String VERSION_FIELD
public static final java.lang.String FILEDOCUMENT_CONTENT_TYPE_FIELD
public static final java.lang.String FILEDOCUMENT_FILE_EXTENSION_FIELD
public static final java.lang.String FILEDOCUMENT_FILENAME_FIELD
public static final java.lang.String FILEDOCUMENT_ORIGINAL_FILENAME_FIELD
public static final java.lang.String HITS_TIMEOUT_PROP
public static final java.text.DateFormat dateFormatter
protected static final long HITS_TIMEOUT
protected SpellSuggestEngine spellSuggestEngine
public LucenePublicationSearchEngine() throws java.lang.Exception
java.lang.Exception
- if the Publication search engine could not be instanciated correctlypublic void add(Publication pub)
Publication
to this lucene search engine.
This method is asynchronous, the given data may not be (and will
certainly not be) added immediately after call.add
in interface PublicationSearchEngine
pub
- the Publication
to index .public void update(Publication pub)
Publication
in this lucene search engine.
This method is asynchronous, the given data may not be (and will
certainly not be) updated immediately after call.update
in interface PublicationSearchEngine
pub
- the Publication
to reindex .public void delete(Publication pub)
Publication
from this lucene search engine.
This method is asynchronous, the given data may not be (and will
certainly not be) deleted immediately after call.delete
in interface PublicationSearchEngine
pub
- the Publication
to reindex .public void add(java.util.Collection<? extends Publication> coll)
Collection
of Publication
to this lucene search engine.
This method is asynchronous, the given datas may not be (and will
certainly not be) added immediately after call.add
in interface PublicationSearchEngine
coll
- the Collection
of Publication
to index .public void update(java.util.Collection<? extends Publication> coll)
Collection
of Publication
in this lucene search engine.
This method is asynchronous, the given datas may not be (and will
certainly not be) updated immediately after call.update
in interface PublicationSearchEngine
coll
- the Collection
of Publication
to reindex .public void delete(java.util.Collection<? extends Publication> coll)
Collection
of Publication
from this lucene search engine.
This method is asynchronous, the given datas may not be (and will
certainly not be) deleted immediately after call.delete
in interface PublicationSearchEngine
coll
- the Collection
of Publication
to reindex .public java.util.Date getIndexingDate(Publication pub)
getIndexingDate
in interface PublicationSearchEngine
pub
- the Publication
for which to retrieve the indexing date.public void clearAll()
clearAll
in interface PublicationSearchEngine
public boolean search(QueryHandler qh, java.util.HashSet<? extends Publication> pubSet, QueryResultSet resultSet)
Publication
using lucene search engine. QueryHandler
(qh.getText()).Analyzer
of the user's language.Publication
into returned Set only if they are already
in the given pubSet
or if pubSet
is null.search
in interface PublicationSearchEngine
qh
- the Queryhandler in which to find search text and search options.pubSet
- a HashSet containing all the Publication
to search. Publication
found will be returned. resultSet
- the QueryResultSet
that must be filled
with matching Publication
public java.util.LinkedHashMap<java.lang.String,java.lang.Float> search(QueryHandler qh, java.util.List<java.lang.String> idList)
search
in interface PublicationSearchEngine
qh
- the Queryhandler in which to find search text and search options.idList
- the list of publication's identifieridList
and respect its order.public java.util.LinkedHashMap<java.lang.String,java.lang.Float> search(QueryHandler qh)
PublicationSearchEngine
search
in interface PublicationSearchEngine
qh
- the Queryhandler in which to find search text and search options.public SpellSuggestEngine getSpellSuggestEngine()
protected org.apache.log4j.Logger getLogger()
LuceneDataSearchEngine
getLogger
in class LuceneDataSearchEngine
Logger
of this engine.protected com.jalios.jcms.search.DataIterator<Data> getAllDataIterator()
LuceneDataSearchEngine
LuceneDataSearchEngine.reindexAll()
.getAllDataIterator
in class LuceneDataSearchEngine
protected void indexData(org.apache.lucene.index.IndexWriter writer, Data data, java.lang.String lang) throws java.io.IOException
indexData
in class LuceneDataSearchEngine
java.io.IOException
public void addStoredField(org.apache.lucene.document.Document doc, Publication pub, java.lang.String lang, java.lang.String fieldName, java.lang.String fieldValue)
Field
with the given field's value
of the given Publication
in the given language, and add into the given Document
.doc
- the lucene Document in which field will be addedpub
- the publication for which field is addedlang
- the language in which field is added, if relevantfieldName
- the name of the field in the lucene indexfieldValue
- the value of the field in the lucene indexpublic void addUnStoredField(org.apache.lucene.document.Document doc, Publication pub, java.lang.String lang, java.lang.String fieldName, java.lang.String fieldValue)
Field
with the given field's value
of the given Publication
in the given language, and add into the given Document
.doc
- the lucene Document in which field will be addedpub
- the publication for which field is addedlang
- the language in which field is added, if relevantfieldName
- the name of the field in the lucene indexfieldValue
- the value of the field in the lucene indexpublic void addKeywordField(org.apache.lucene.document.Document doc, Publication pub, java.lang.String lang, java.lang.String fieldName, java.lang.String fieldValue)
Field
with the given field's value
of the given Publication
in the given language, and add into the given Document
.doc
- the lucene Document in which field will be addedpub
- the publication for which field is addedlang
- the language in which field is added, if relevantfieldName
- the name of the field in the lucene indexfieldValue
- the value of the field in the lucene indexpublic void addRawField(org.apache.lucene.document.Document doc, Publication pub, java.lang.String lang, java.lang.String fieldName, java.lang.String fieldValue)
Field
with the given field's value
of the given Publication
in the given language, and add into the given Document
.doc
- the lucene Document in which field will be addedpub
- the publication for which field is addedlang
- the language in which field is added, if relevantfieldName
- the name of the field in the lucene indexfieldValue
- the value of the field in the lucene indexpublic static boolean hasAdvancedLuceneQuery(QueryHandler qh)
qh
- the QueryHandler to checkCopyright © 2001-2010 Jalios SA. All Rights Reserved.