|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.search.LuceneDataSearchEngine com.jalios.jcms.search.LucenePublicationSearchEngine
public class LucenePublicationSearchEngine
This PublicationSearchEngine
is reponsible for the indexing and searching of JCMS
content using lucene.
Architecture and notable points:
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);
Field Summary | |
---|---|
static String |
ABSTRACT_FIELD
|
static String |
ADATE_FIELD
|
static String |
ALLFIELDS_FIELD
|
static String |
AUTHORID_FIELD
|
static String |
CDATE_FIELD
|
static DateFormat |
dateFormatter
|
static String |
EDATE_FIELD
|
static String |
FILEDOCUMENT_CONTENT_TYPE_FIELD
|
static String |
FILEDOCUMENT_FILE_EXTENSION_FIELD
|
static String |
FILEDOCUMENT_FILENAME_FIELD
|
static String |
FILEDOCUMENT_ORIGINAL_FILENAME_FIELD
|
protected static long |
HITS_TIMEOUT
|
static String |
HITS_TIMEOUT_PROP
|
static String |
LUCENE_ADVANCED_QUERY_ATTRIBUTE
QueryHandler attribute name for the optionnal advanced lucene query that can be performed with this Engine. |
static String |
LUCENE_CUSTOM_QUERY_ATTRIBUTE
QueryHandler attribute name for the optionnal advanced lucene query that can be performed with this Engine. |
static String |
PDATE_FIELD
|
static String |
PSTATUS_FIELD
|
protected static String |
PUBLICATION_INDEX_DIRECTORY
|
static String |
REVISION
|
static String |
SDATE_FIELD
|
static 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 String |
TITLE_FIELD
|
static String |
VERSION_FIELD
|
static String |
WORKSPACEID_FIELD
|
Fields inherited from class com.jalios.jcms.search.LuceneDataSearchEngine |
---|
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 |
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 | |
---|---|
LucenePublicationSearchEngine()
Initialize the Lucene Search Engine |
Method Summary | |
---|---|
void |
add(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,
String lang,
String fieldName,
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,
String lang,
String fieldName,
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,
String lang,
String fieldName,
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,
String lang,
String fieldName,
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(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. |
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,
String lang)
This methods index the given publication in the given language, into the given index writer. |
LinkedHashMap<String,Float> |
search(QueryHandler qh)
Return the list of publication's identifier with a lucene search. |
boolean |
search(QueryHandler qh,
HashSet<? extends Publication> pubSet,
QueryResultSet resultSet)
Search Publication using lucene search engine. |
LinkedHashMap<String,Float> |
search(QueryHandler qh,
List<String> idList)
Filters the given list of publication's identifier with a lucene search. |
void |
update(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. |
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
public static final String SPELLSUGGEST_ATTRIBUTE
public static final 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 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 String PUBLICATION_INDEX_DIRECTORY
public static final String TITLE_FIELD
public static final String ABSTRACT_FIELD
public static final String ALLFIELDS_FIELD
public static final String AUTHORID_FIELD
public static final String PSTATUS_FIELD
public static final String WORKSPACEID_FIELD
public static final String CDATE_FIELD
public static final String PDATE_FIELD
public static final String SDATE_FIELD
public static final String EDATE_FIELD
public static final String ADATE_FIELD
public static final String VERSION_FIELD
public static final String FILEDOCUMENT_CONTENT_TYPE_FIELD
public static final String FILEDOCUMENT_FILE_EXTENSION_FIELD
public static final String FILEDOCUMENT_FILENAME_FIELD
public static final String FILEDOCUMENT_ORIGINAL_FILENAME_FIELD
public static final String HITS_TIMEOUT_PROP
public static final DateFormat dateFormatter
protected static final long HITS_TIMEOUT
protected SpellSuggestEngine spellSuggestEngine
Constructor Detail |
---|
public LucenePublicationSearchEngine() throws Exception
Exception
- if the Publication search engine could not be instanciated correctlyMethod Detail |
---|
public 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(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(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(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 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, 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 LinkedHashMap<String,Float> search(QueryHandler qh, List<String> idList)
search
in interface PublicationSearchEngine
qh
- the Queryhandler in which to find search text and search options.idList
- the list of publication's identifier
idList
and respect its order.public LinkedHashMap<String,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, String lang) throws IOException
indexData
in class LuceneDataSearchEngine
IOException
public void addStoredField(org.apache.lucene.document.Document doc, Publication pub, String lang, String fieldName, 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, String lang, String fieldName, 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, String lang, String fieldName, 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, String lang, String fieldName, 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 check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |