Class LuceneArchiveEngine

    • Constructor Detail

      • LuceneArchiveEngine

        public LuceneArchiveEngine()
    • Method Detail

      • init

        public void init()
                  throws java.lang.Exception
        Initialize Lucene Index
        Specified by:
        init in interface ArchiveEngine
        Throws:
        java.lang.Exception
      • getDirectory

        public org.apache.lucene.store.FSDirectory getDirectory()
        Returns the lucene directory used by this LuceneArchiveEngine.
        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.
      • indexPublication

        public void indexPublication​(Publication pub,
                                     ArchivedPublication archive)
                              throws java.lang.Exception
        Index a Publication
        Specified by:
        indexPublication in interface ArchiveEngine
        Parameters:
        pub - the Publication to index
        archive - the newly created ArchivedPublication corresponding
        Throws:
        java.lang.Exception
      • search

        public java.util.Set<java.lang.Long> search​(java.lang.String text,
                                                    java.lang.String mode)
        Perform a full-text search on archives.
        Specified by:
        search in interface ArchiveEngine
        Parameters:
        text - the text to search
        mode - the search mode
        Returns:
        a Set of Long (the rowid of the matching ArchivedPublication)
        Since:
        jcms-6.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.archive.max-results

        Returns:
        a maximum number of result retrieve (result beyong this limit are ignored)
      • getLuceneQuery

        public static java.lang.String getLuceneQuery​(java.lang.String text,
                                                      java.lang.String mode)
        Build a lucene query from the given parameters.

        Very naive implementation.

        Parameters:
        text - the search string
        mode - the query mode (all, any, word, exact)
        Returns:
        a String which contains the lucene-compliant query
      • deleteArchiveIndex

        public void deleteArchiveIndex​(ArchivedPublication pub)
        Delete every information associated with the publication
        Specified by:
        deleteArchiveIndex in interface ArchiveEngine
        Parameters:
        pub - the ArchivedPublication being deleted