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
  • Field Details

  • Method Details

    • getInstance

      public static LuceneMemberSearchEngine getInstance() throws 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:
      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 Date getIndexingDate(Member mbr)
      Retrieve the Date at which the specified Member was indexed.
      Parameters:
      mbr - the Member 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
      Returns the AdminSearchEnginesHandler.Action to use when starting an AdminSearchEngineProcess for a full reindex.
      Specified by:
      getReindexAllAction in class LuceneDataSearchEngine
    • 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, attribute MAXIMUM_RESULTS_NUMBER_REACHED is added to the AllMemberQueryHandler 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

      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, attribute MAXIMUM_RESULTS_NUMBER_REACHED is added to the AllMemberQueryHandler 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
      Returns the Logger used for all log messages emitted by this engine.
      Specified by:
      getLogger in class LuceneDataSearchEngine
      Returns:
      Logger of this engine.
    • getDataIterator

      protected DataIterator<Data> getDataIterator(LuceneDataSearchEngine.ReindexOptions options)
      Description copied from class: LuceneDataSearchEngine
      Returns a DataIterator over all Data objects to be indexed, filtered according to the given LuceneDataSearchEngine.ReindexOptions.
      Specified by:
      getDataIterator in class LuceneDataSearchEngine
      Parameters:
      options - reindex configuration
      Returns:
      a non-null DataIterator
    • indexData

      protected void indexData(org.apache.lucene.index.IndexWriter writer, Data data, String lang, boolean isFullReindexing) throws IOException
      This methods index the specified Member.
      Specified by:
      indexData in class LuceneDataSearchEngine
      Parameters:
      writer - target Lucene writer
      data - the Data to index
      lang - ISO-639 language code
      isFullReindexing - true if operation is for a full reindexing with a empty index, false if updating an existing index
      Throws:
      IOException - on I/O error