com.jalios.jcms.search

Class LucenePublicationSearchEngine

Since:
jcms-5.5.0
Version:
$Revision: 49040 $
    • Field Detail

      • SPELLSUGGEST_ATTRIBUTE

        public static final 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.
        See Also:
        Constant Field Values
      • LUCENE_ADVANCED_QUERY_ATTRIBUTE

        public static final java.lang.String LUCENE_ADVANCED_QUERY_ATTRIBUTE
        QueryHandler attribute name for the optionnal advanced lucene query that can be performed with this Engine.

        Example to require a custom field :

         QueryHandler qh = new QueryHandler();
         //qh.set(...)
         qh.setAttribute(LUCENE_ADVANCED_QUERY_ATTRIBUTE, "+myField:somevalue"); 
         QueryResultSet qrs = qh.getResultSet();
         
        See Also:
        Constant Field Values
      • LUCENE_CUSTOM_QUERY_ATTRIBUTE

        public static final java.lang.String LUCENE_CUSTOM_QUERY_ATTRIBUTE
        QueryHandler attribute name for the optionnal advanced lucene query that can be performed with this Engine.

        Example to require a custom field :

         QueryHandler qh = new QueryHandler();
         //qh.set(...)
         qh.setAttribute(LUCENE_CUSTOM_QUERY_ATTRIBUTE, new BooleanQuery(...)); 
         QueryResultSet qrs = qh.getResultSet();
         
        See Also:
        Constant Field Values
      • PUBLICATION_INDEX_DIRECTORY

        protected static final java.lang.String PUBLICATION_INDEX_DIRECTORY
        See Also:
        Constant Field Values
      • WORKSPACEID_FIELD

        public static final java.lang.String WORKSPACEID_FIELD
        See Also:
        Constant Field Values
      • FILEDOCUMENT_CONTENT_TYPE_FIELD

        public static final java.lang.String FILEDOCUMENT_CONTENT_TYPE_FIELD
        See Also:
        Constant Field Values
      • FILEDOCUMENT_FILE_EXTENSION_FIELD

        public static final java.lang.String FILEDOCUMENT_FILE_EXTENSION_FIELD
        See Also:
        Constant Field Values
      • FILEDOCUMENT_FILENAME_FIELD

        public static final java.lang.String FILEDOCUMENT_FILENAME_FIELD
        See Also:
        Constant Field Values
      • FILEDOCUMENT_ORIGINAL_FILENAME_FIELD

        public static final java.lang.String FILEDOCUMENT_ORIGINAL_FILENAME_FIELD
        See Also:
        Constant Field Values
      • HITS_TIMEOUT_PROP

        public static final java.lang.String HITS_TIMEOUT_PROP
        See Also:
        Constant Field Values
      • dateFormatter

        public static final java.text.DateFormat dateFormatter
      • HITS_TIMEOUT

        protected static final long HITS_TIMEOUT
    • Constructor Detail

      • LucenePublicationSearchEngine

        public LucenePublicationSearchEngine()
                                      throws java.lang.Exception
        Initialize the Lucene Search Engine
        Throws:
        java.lang.Exception - if the Publication search engine could not be instanciated correctly
    • Method Detail

      • add

        public void add(Publication pub)
        Add given 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.
        Specified by:
        add in interface PublicationSearchEngine
        Parameters:
        pub - the Publication to index .
      • update

        public void update(Publication pub)
        Update given 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.
        Specified by:
        update in interface PublicationSearchEngine
        Parameters:
        pub - the Publication to reindex .
      • delete

        public void delete(Publication pub)
        Delete given 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.
        Specified by:
        delete in interface PublicationSearchEngine
        Parameters:
        pub - the Publication to reindex .
      • add

        public void add(java.util.Collection<? extends Publication> coll)
        Add given 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.
        Specified by:
        add in interface PublicationSearchEngine
        Parameters:
        coll - the Collection of Publication to index .
      • update

        public void update(java.util.Collection<? extends Publication> coll)
        Update given 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.
        Specified by:
        update in interface PublicationSearchEngine
        Parameters:
        coll - the Collection of Publication to reindex .
      • delete

        public void delete(java.util.Collection<? extends Publication> coll)
        Delete given 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.
        Specified by:
        delete in interface PublicationSearchEngine
        Parameters:
        coll - the Collection of Publication to reindex .
      • getIndexingDate

        public java.util.Date getIndexingDate(Publication pub)
        Retrieve the Date at which the specified Publication was indexed in the search engine.
        Specified by:
        getIndexingDate in interface PublicationSearchEngine
        Parameters:
        pub - the Publication for which to retrieve the indexing date.
        Returns:
        the indexing date of the publication or null if was not indexed.
        Since:
        jcms-6.0.1
      • search

        public boolean search(QueryHandler qh,
                     java.util.HashSet<? extends Publication> pubSet,
                     QueryResultSet resultSet)
        Search Publication using lucene search engine.
      • Search in all lucene indices using text of QueryHandler (qh.getText()).
      • Uses only the Lucene Analyzer of the user's language.
      • Add Publication into returned Set only if they are already in the given pubSet or if pubSet is null.
      • Caution! This method ignores all DBData.
Specified by:
search in interface PublicationSearchEngine
Parameters:
qh - the Queryhandler in which to find search text and search options.
pubSet - a HashSet containing all the Publication to search.
if empty, search is not performed at all.
if null, all Publication found will be returned.
This set MUST NOT be modified by implementation.
resultSet - the QueryResultSet that must be filled with matching Publication
Returns:
true if a search was performed in the PublicationSearchEngine. Useful to differenciate a query returning zero result from a query not performed due to missing paramerters (text for example).
Since:
jcms-5.5.0

Copyright © 2001-2010 Jalios SA. All Rights Reserved.