Interface SearchEngine

  • All Known Implementing Classes:
    StandardSearchEngine

    public interface SearchEngine
    Model of a search engine with search and I/O capabilities. Various implementations can be provided, and the configuration property searchengine must qualify the concrete implementation to use.
    Since:
    6.5
    Author:
    Marco Meschieri - LogicalDOC
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addHit​(Document document, InputStream content)
      Adds a new hit to the index
      void addHit​(Document document, String content)
      Adds a new Hit into the index
      String check()
      Launch the check on the Index
      void close()
      Closes all indexing operations, shuts down the engine.
      void deleteHit​(long id)
      Deletes an hit in the index of the search engine.
      void deleteHits​(Collection<Long> ids)
      Removed all passed hits from the index
      void dropIndex()
      Drops the full-text index
      long getCount()
      Returns the number of indexed documents in all indexes.
      Hit getHit​(long id)  
      Object getServer()
      Service method to get access from the internal core
      void init()
      To be called on the context startup, this method creates all indexes and unlock the existing ones
      boolean isLocked()
      Check if at least one index is locked
      void optimize()
      Launch the index optimization and triggers the build of spellcheck dictionary
      Hits search​(String expression, String[] filters, String expressionLanguage, Integer rows)
      Search for hits.
      Attention: The hits will be populated with just the fields stored in the index
      void unlock()
      This method can unlock a locked index.
    • Method Detail

      • addHit

        void addHit​(Document document,
                    String content)
             throws Exception
        Adds a new Hit into the index
        Parameters:
        document - The document to add into the index
        content - The extracted body text
        Throws:
        Exception - is an error happens and the document cannot be added to the index
      • addHit

        void addHit​(Document document,
                    InputStream content)
             throws Exception
        Adds a new hit to the index
        Parameters:
        content - Stream of the document's file
        document - The document that we want to add
        Throws:
        Exception - is an error happens and the document cannot be added to the index
      • optimize

        void optimize()
        Launch the index optimization and triggers the build of spellcheck dictionary
      • check

        String check()
        Launch the check on the Index
        Returns:
        the output of the check
      • deleteHit

        void deleteHit​(long id)
        Deletes an hit in the index of the search engine.
        Parameters:
        id - - id of the hit
      • deleteHits

        void deleteHits​(Collection<Long> ids)
        Removed all passed hits from the index
        Parameters:
        ids - Collection of hit identifiers
      • getHit

        Hit getHit​(long id)
      • search

        Hits search​(String expression,
                    String[] filters,
                    String expressionLanguage,
                    Integer rows)
        Search for hits.
        Attention: The hits will be populated with just the fields stored in the index
        Parameters:
        expression - the search expression
        filters - a set of filter expressions, optional
        expressionLanguage - the language in which the expression is writted
        rows - maximum number elements to be returned
        Returns:
        the hits
      • close

        void close()
        Closes all indexing operations, shuts down the engine.
      • unlock

        void unlock()
        This method can unlock a locked index.
      • isLocked

        boolean isLocked()
        Check if at least one index is locked
        Returns:
        true if one or more indexes are locked
      • getCount

        long getCount()
        Returns the number of indexed documents in all indexes. Used for statistical output.
        Returns:
        the total number of entries in the index
      • dropIndex

        void dropIndex()
        Drops the full-text index
      • init

        void init()
        To be called on the context startup, this method creates all indexes and unlock the existing ones
      • getServer

        Object getServer()
        Service method to get access from the internal core
        Returns:
        the search server representation