Class LuceneMemberSearchEngine

    • 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 - 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
      • 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, 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
        This methods must be implemented by the LuceneSearchEngine. It must return the logger to be used for log messages.
        Specified by:
        getLogger in class LuceneDataSearchEngine
        Returns:
        Logger of this engine.
      • 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 class LuceneDataSearchEngine
        Throws:
        java.io.IOException