Class LuceneMemberSearchEngine
- java.lang.Object
-
- com.jalios.jcms.search.LuceneDataSearchEngine
-
- com.jalios.jcms.search.LuceneMemberSearchEngine
-
- All Implemented Interfaces:
JcmsConstants
,JaliosConstants
public class LuceneMemberSearchEngine extends LuceneDataSearchEngine implements JcmsConstants
Provides member indexing and search.- Since:
- jcms-6.1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.jalios.jcms.search.LuceneDataSearchEngine
LuceneDataSearchEngine.IndexingLatch, LuceneDataSearchEngine.ReindexOptions
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ADMIN_FIELD
static java.lang.String
ALLFIELDS_FIELD
static java.lang.String
CDATE_FIELD
static java.lang.String
CLEARANCE_LEVEL_FIELD
static java.lang.String
DEPARTMENT_FIELD
static java.lang.String
EMAIL_FIELD
static java.lang.String
ENABLED_FIELD
static java.lang.String
EXTERNALAUTH_FIELD
static java.lang.String
FIRSTNAME_FIELD
static java.lang.String
GROUPS_FIELD
static java.lang.String
ID_FIELD
static java.lang.String
INDEXING_DATE_EXTRAINFO
static java.lang.String
INDEXING_DATE_FIELD
static java.lang.String
JOBTITLE_FIELD
static java.lang.String
LASTNAME_FIELD
static java.lang.String
LDAP_FIELD
static java.lang.String
LOCALITY_FIELD
static java.lang.String
LOGIN_FIELD
static java.lang.String
MAXIMUM_RESULTS_NUMBER_REACHED
QueryHandler handler attribute indicating that the maximum number of results allowed in a member search was exceeded.static java.lang.String
MDATE_FIELD
protected static java.lang.String
MEMBER_ENGINE_NAME
protected static java.lang.String
MEMBER_INDEX_DIRECTORY
static java.lang.String
ORGANIZATION_FIELD
static java.lang.String
PHONES_FIELD
static java.lang.String
POSTALCODE_FIELD
static java.lang.String
REGION_FIELD
static java.lang.String
TYPE_FIELD
static java.lang.String
USAGE_FIELD
-
Fields inherited from class com.jalios.jcms.search.LuceneDataSearchEngine
alarmMgr, BACKGROUND_PROCESS_MGR, channel, directoryName, engineName, indexAccessLock, langList, langToIndexDirMap, langToIndexWriterMap, 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
-
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, CLASS_PROPERTY, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, CS_TYPOLOGY_ROOT_CAT_VID, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DATA_DIRECTORY, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, IS_IN_FRONT_OFFICE, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, 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, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_MINI, PHOTO_MINI_HEIGHT, PHOTO_MINI_PROP_PREFIX, PHOTO_MINI_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, RAW_CONTENT_ICON_PREFIX, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SECURITY_LOG_FILE, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_DIR, STORE_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_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, UPLOAD_PERMISSION_COUNT_PROP_PREFIX, UPLOAD_PERMISSION_SIZE_PROP_PREFIX, URL_REGEXP, VID_LOGGED_MEMBER, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Member mbr)
Add the specified Member to the lucene index.protected DataIterator<Data>
getDataIterator(LuceneDataSearchEngine.ReindexOptions options)
This methods must be implemented by the LuceneSearchEngine.org.apache.lucene.store.FSDirectory
getDirectory()
Returns the lucene directory used by this LuceneMemberSearchEngine.java.util.Date
getIndexingDate(Member mbr)
Retrieve the Date at which the specified Member was indexed.static LuceneMemberSearchEngine
getInstance()
Retrieve the LuceneMemberSearchEngine singleton.protected org.apache.log4j.Logger
getLogger()
This methods must be implemented by the LuceneSearchEngine.org.apache.lucene.document.Document
getLuceneDocument(Member mbr)
Retrieve a new lucene Document for the specified Member in preparation of indexing.static int
getMaximumResults()
Retrieve the maximum number of results allowed to be return for a search.protected AdminSearchEnginesHandler.Action
getReindexAllAction()
Retrieve the Action to use when starting aAdminSearchEngineProcess
for full reindexing.protected void
indexData(org.apache.lucene.index.IndexWriter writer, Data data, java.lang.String lang)
This methods index the specified Member.void
optimize()
Realize a Lucene optimization of the Lucene Member Index.void
remove(Member mbr)
Remove the specified Member from the lucene index.java.util.LinkedHashMap<java.lang.String,java.lang.Float>
search(AllMemberQueryHandler amqh)
Search all members (Member and DBMember) using the specified criteria (paging excepted).PageResult<Member>
searchPage(AllMemberQueryHandler amqh)
Search all members (Member and DBMember) using the specified criteria.void
update(Member mbr)
Update the specified Member in the lucene index.-
Methods inherited from class com.jalios.jcms.search.LuceneDataSearchEngine
acquireSearcher, addData, addDataCollection, clearIndices, clearSearcher, createSnapshot, deleteData, deleteDataCollection, getAllDataIterator, getAnalyzer, getDirectory, getIndexingDate, getIndexingDate, getIndexingLatch, getIndexWriter, getLastOptimizeDateSinceRestart, getLastOptimizeDuration, getLastReindexDateSinceRestart, getLastReindexDuration, getLuceneDocument, getOperationStartTime, getPrimaryTerm, getProgressState, getSearcherManager, getSimilarity, index, index, isOperationRunning, optimizeIndices, reindex, reindexAll, releaseSearcher, remove, updateData, updateDataCollection
-
-
-
-
Field Detail
-
MEMBER_ENGINE_NAME
protected static final java.lang.String MEMBER_ENGINE_NAME
- See Also:
- Constant Field Values
-
MEMBER_INDEX_DIRECTORY
protected static final java.lang.String MEMBER_INDEX_DIRECTORY
- See Also:
- Constant Field Values
-
ID_FIELD
public static final java.lang.String ID_FIELD
- See Also:
- Constant Field Values
-
CDATE_FIELD
public static final java.lang.String CDATE_FIELD
- See Also:
- Constant Field Values
-
MDATE_FIELD
public static final java.lang.String MDATE_FIELD
- See Also:
- Constant Field Values
-
ALLFIELDS_FIELD
public static final java.lang.String ALLFIELDS_FIELD
- See Also:
- Constant Field Values
-
INDEXING_DATE_FIELD
public static final java.lang.String INDEXING_DATE_FIELD
- See Also:
- Constant Field Values
-
INDEXING_DATE_EXTRAINFO
public static final java.lang.String INDEXING_DATE_EXTRAINFO
- See Also:
- Constant Field Values
-
TYPE_FIELD
public static final java.lang.String TYPE_FIELD
- See Also:
- Constant Field Values
-
LOGIN_FIELD
public static final java.lang.String LOGIN_FIELD
- See Also:
- Constant Field Values
-
FIRSTNAME_FIELD
public static final java.lang.String FIRSTNAME_FIELD
- See Also:
- Constant Field Values
-
LASTNAME_FIELD
public static final java.lang.String LASTNAME_FIELD
- See Also:
- Constant Field Values
-
EMAIL_FIELD
public static final java.lang.String EMAIL_FIELD
- See Also:
- Constant Field Values
-
JOBTITLE_FIELD
public static final java.lang.String JOBTITLE_FIELD
- See Also:
- Constant Field Values
-
DEPARTMENT_FIELD
public static final java.lang.String DEPARTMENT_FIELD
- See Also:
- Constant Field Values
-
ORGANIZATION_FIELD
public static final java.lang.String ORGANIZATION_FIELD
- See Also:
- Constant Field Values
-
POSTALCODE_FIELD
public static final java.lang.String POSTALCODE_FIELD
- See Also:
- Constant Field Values
-
LOCALITY_FIELD
public static final java.lang.String LOCALITY_FIELD
- See Also:
- Constant Field Values
-
REGION_FIELD
public static final java.lang.String REGION_FIELD
- See Also:
- Constant Field Values
-
GROUPS_FIELD
public static final java.lang.String GROUPS_FIELD
- See Also:
- Constant Field Values
-
USAGE_FIELD
public static final java.lang.String USAGE_FIELD
- See Also:
- Constant Field Values
-
PHONES_FIELD
public static final java.lang.String PHONES_FIELD
- See Also:
- Constant Field Values
-
ENABLED_FIELD
public static final java.lang.String ENABLED_FIELD
- See Also:
- Constant Field Values
-
ADMIN_FIELD
public static final java.lang.String ADMIN_FIELD
- See Also:
- Constant Field Values
-
EXTERNALAUTH_FIELD
public static final java.lang.String EXTERNALAUTH_FIELD
- See Also:
- Constant Field Values
-
LDAP_FIELD
public static final java.lang.String LDAP_FIELD
- See Also:
- Constant Field Values
-
CLEARANCE_LEVEL_FIELD
public static final java.lang.String CLEARANCE_LEVEL_FIELD
- See Also:
- Constant Field Values
-
MAXIMUM_RESULTS_NUMBER_REACHED
public static final java.lang.String MAXIMUM_RESULTS_NUMBER_REACHED
QueryHandler handler attribute indicating that the maximum number of results allowed in a member search was exceeded.Attribute value is the number of results obtained.
Authorized limit can be retrieved usinggetMaximumResults()
.- Since:
- jcms-9.0.1 JCMS-4321
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static LuceneMemberSearchEngine getInstance() throws java.lang.Exception
Retrieve the LuceneMemberSearchEngine singleton.After engine has been started during Channel startup, use
Channel.getMemberSearchEngine()
to retrieve singleton getter without having to catch exception.- Returns:
- the LuceneMemberSearchEngine singleton.
- Throws:
java.lang.Exception
- if was not initialized and the initialization failed.- Since:
- jcms-6.1.0
-
getDirectory
public org.apache.lucene.store.FSDirectory getDirectory()
Returns the lucene directory used by this LuceneMemberSearchEngine.
Warning!!! you should not modify the index, use this method only to access the directory in readonly !.- Returns:
- the instance of the FSDirectory used internally.
- Since:
- jcms-6.1.0
-
getIndexingDate
public java.util.Date getIndexingDate(Member mbr)
Retrieve the Date at which the specified Member was indexed.- Parameters:
mbr
- theMember
for which to retrieve the indexing date.- Returns:
- the indexing date of the Member or null if was not indexed.
- Since:
- jcms-6.1.0
-
getReindexAllAction
protected AdminSearchEnginesHandler.Action getReindexAllAction()
Description copied from class:LuceneDataSearchEngine
Retrieve the Action to use when starting aAdminSearchEngineProcess
for full reindexing.- Specified by:
getReindexAllAction
in classLuceneDataSearchEngine
- Returns:
-
searchPage
public PageResult<Member> searchPage(AllMemberQueryHandler amqh)
Search all members (Member and DBMember) using the specified criteria.No more than
getMaximumResults()
Members will be returned, if this limit is reached, attributeMAXIMUM_RESULTS_NUMBER_REACHED
is added to theAllMemberQueryHandler
with the total count of Member retrieved.- Parameters:
amqh
- the AllMemberQueryHandler instance specifying search criteria.- Returns:
- a new PageResult of Member, never return null
- Since:
- jcms-6.1.0
-
search
public java.util.LinkedHashMap<java.lang.String,java.lang.Float> search(AllMemberQueryHandler amqh)
Search all members (Member and DBMember) using the specified criteria (paging excepted).No more than
getMaximumResults()
Members will be returned, if this limit is reached, attributeMAXIMUM_RESULTS_NUMBER_REACHED
is added to theAllMemberQueryHandler
with the total count of Member retrieved.- Parameters:
amqh
- the AllMemberQueryHandler instance specifying search criteria.- Returns:
- a new map of Member id to relevance, never return null
- Since:
- jcms-6.1.0
-
getMaximumResults
public static int getMaximumResults()
Retrieve the maximum number of results allowed to be return for a search.Can be configured using property
query.lucene.mbr.max-results
- Returns:
- a maximum number of result retrieve (result beyong this limit are ignored)
-
add
public void add(Member mbr)
Add the specified Member to the lucene index.- Parameters:
mbr
- the Member to be added to lucene.- Since:
- jcms-6.1
-
update
public void update(Member mbr)
Update the specified Member in the lucene index.- Parameters:
mbr
- the Member to be update in lucene.- Since:
- jcms-6.1
-
remove
public void remove(Member mbr)
Remove the specified Member from the lucene index.- Parameters:
mbr
- the Member to be removed from lucene.- Since:
- jcms-6.1
-
getLuceneDocument
public org.apache.lucene.document.Document getLuceneDocument(Member mbr)
Retrieve a new lucene Document for the specified Member in preparation of indexing.- Parameters:
mbr
- the Member to index (must no be null).- Returns:
- A new instance of Document suitable for indexation
- Since:
- jcms-6.1.0
-
optimize
public void optimize()
Realize a Lucene optimization of the Lucene Member Index.Warning: This is a potentially long and heavy process on large index, do not call without being sure of what you do. 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.
- Since:
- jcms-6.1.0
-
getLogger
protected org.apache.log4j.Logger getLogger()
Description copied from class:LuceneDataSearchEngine
This methods must be implemented by the LuceneSearchEngine. It must return the logger to be used for log messages.- Specified by:
getLogger
in classLuceneDataSearchEngine
- Returns:
Logger
of this engine.
-
getDataIterator
protected DataIterator<Data> getDataIterator(LuceneDataSearchEngine.ReindexOptions options)
Description copied from class:LuceneDataSearchEngine
This methods must be implemented by the LuceneSearchEngine. It must return a DataIterator used to iterate on Data to index. Used byLuceneDataSearchEngine.reindex(ReindexOptions)
.- Specified by:
getDataIterator
in classLuceneDataSearchEngine
-
indexData
protected void indexData(org.apache.lucene.index.IndexWriter writer, Data data, java.lang.String lang) throws java.io.IOException
This methods index the specified Member.- Specified by:
indexData
in classLuceneDataSearchEngine
- Throws:
java.io.IOException
-
-