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

    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
    Launch the check on the Index
    void
    Closes all indexing operations, shuts down the engine.
    void
    deleteHit(long id)
    Deletes an hit in the index of the search engine.
    void
    Removed all passed hits from the index
    void
    Drops the full-text index
    long
    Returns the number of indexed documents in all indexes.
    getHit(long id)
     
    Service method to get access from the internal core
    void
    To be called on the context startup, this method creates all indexes and unlock the existing ones
    boolean
    Check if at least one index is locked
    void
    Launch the index optimization that physically deletes the removed entries.
    long
    Removes from the index those entries without a coutnerpart in the database
    query(String expression, int page, int size)
    Executes a low-level query in the fulltext index
    Attention: The hits will be populated with just the fields stored in the index
    search(String expression, Set<String> filters, String expressionLanguage, Integer rows)
    Search for hits.
    Attention: The hits will be populated with just the fields stored in the index
    void
    This method can unlock a locked index.
  • Method Details

    • addHit

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

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

      void optimize()
      Launch the index optimization that physically deletes the removed entries. This is a long running operation.
    • 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, Set<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 ordered by descending score
    • query

      Hits query(String expression, int page, int size)
      Executes a low-level query in the fulltext index
      Attention: The hits will be populated with just the fields stored in the index
      Parameters:
      expression - the query to use
      page - the page to retrieve
      size - the maximum number of entries to retrieve
      Returns:
      the search result, ordered by ascending id
    • 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
    • purge

      long purge()
      Removes from the index those entries without a coutnerpart in the database
      Returns:
      number of deleted entries
    • init

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

      @PreDestroy void close()
      Closes all indexing operations, shuts down the engine.
    • getServer

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