org.eclipse.rdf4j.sail.lucene

## Interface SearchIndex

- All Known Implementing Classes:
    AbstractLuceneIndex, AbstractSearchIndex, ElasticsearchIndex, LuceneIndex, LuceneIndexNIOFS, SolrIndex

      public interface SearchIndex

  A SearchIndex is a one-stop-shop abstraction of a Lucene index. It takes care of proper synchronization of IndexReaders, IndexWriters and IndexSearchers in a way that is suitable for a LuceneSail.
  See Also:
    `LuceneSail`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `accept(Literal literal)` Returns whether the provided literal is accepted by the LuceneIndex to be indexed.
    `void` | `addDocuments(Resource subject, List<Statement> statements)` Add a complete Lucene Document based on these statements.
    `void` | `addRemoveStatements(Collection<Statement> added, Collection<Statement> removed)` Add many statements at the same time, remove many statements at the same time.
    `void` | `addStatement(Statement statement)` Indexes the specified Statement.
    `void` | `begin()` Begins a transaction.
    `void` | `beginReading()` Deprecated.
    `void` | `clear()` Clears the indexes.
    `void` | `clearContexts(Resource... contexts)` This should be called from within a begin-commit-rollback block.
    `void` | `commit()` Commits any changes done to the LuceneIndex since the last commit.
    `void` | `endReading()` Deprecated.
    `Collection<BindingSet>` | `evaluate(QuerySpec query)` Deprecated.
    `Collection<BindingSet>` | `evaluate(SearchQueryEvaluator query)`
    `void` | `initialize(Properties parameters)`
    `boolean` | `isGeoField(String propertyName)` Returns true if the given property contains a geometry.
    `void` | `removeStatement(Statement statement)` Removes the specified Statement from the indexes.
    `void` | `rollback()`
    `void` | `shutDown()`

- - ### Method Detail

    - #### initialize

          void initialize(Properties parameters)
                   throws Exception

      Throws:
        `Exception`

    - #### evaluate

          @Deprecated
          Collection<BindingSet> evaluate(QuerySpec query)
                                               throws SailException

      Deprecated.
      To be removed from interface, prefer `evaluate(SearchQueryEvaluator query)`.
      Throws:
        `SailException`

    - #### evaluate

          Collection<BindingSet> evaluate(SearchQueryEvaluator query)
                                   throws SailException

      Throws:
        `SailException`

    - #### beginReading

          @Deprecated
          void beginReading()
                                 throws IOException

      Deprecated.
      Throws:
        `IOException`

    - #### endReading

          @Deprecated
          void endReading()
                               throws IOException

      Deprecated.
      Throws:
        `IOException`

    - #### shutDown

          void shutDown()
                 throws IOException

      Throws:
        `IOException`

    - #### accept

          boolean accept(Literal literal)

      Returns whether the provided literal is accepted by the LuceneIndex to be indexed. It for instance does not make much since to index xsd:float.
      Parameters:
        `literal` - the literal to be accepted
      Returns:
        true if the given literal will be indexed by this LuceneIndex

    - #### isGeoField

          boolean isGeoField(String propertyName)

      Returns true if the given property contains a geometry.

    - #### begin

          void begin()
              throws IOException

      Begins a transaction.
      Throws:
        `IOException`

    - #### commit

          void commit()
               throws IOException

      Commits any changes done to the LuceneIndex since the last commit. The semantics is synchronous to SailConnection.commit(), i.e. the LuceneIndex should be committed/rollbacked whenever the LuceneSailConnection is committed/rollbacked.
      Throws:
        `IOException`

    - #### rollback

          void rollback()
                 throws IOException

      Throws:
        `IOException`

    - #### addStatement

          void addStatement(Statement statement)
                     throws IOException

      Indexes the specified Statement. This should be called from within a begin-commit-rollback block.
      Throws:
        `IOException`

    - #### removeStatement

          void removeStatement(Statement statement)
                        throws IOException

      Removes the specified Statement from the indexes. This should be called from within a begin-commit-rollback block.
      Throws:
        `IOException`

    - #### addRemoveStatements

          void addRemoveStatements(Collection<Statement> added,
                                   Collection<Statement> removed)
                            throws IOException

      Add many statements at the same time, remove many statements at the same time. Ordering by resource has to be done inside this method. The passed added/removed sets are disjunct, no statement can be in both. This should be called from within a begin-commit-rollback block.
      Parameters:
        `added` - all added statements, can have multiple subjects
        `removed` - all removed statements, can have multiple subjects
      Throws:
        `IOException`

    - #### clearContexts

          void clearContexts(Resource... contexts)
                      throws IOException

      This should be called from within a begin-commit-rollback block.
      Parameters:
        `contexts` -
        `sail` - - the underlying native sail where to read the missing triples from after deletion
      Throws:
        `SailException`
        `IOException`

    - #### addDocuments

          void addDocuments(Resource subject,
                            List<Statement> statements)
                     throws IOException

      Add a complete Lucene Document based on these statements. Do not search for an existing document with the same subject id. (assume the existing document was deleted). This should be called from within a begin-commit-rollback block.
      Parameters:
        `statements` - the statements that make up the resource
      Throws:
        `IOException`

    - #### clear

          void clear()
              throws IOException

      Clears the indexes.
      Throws:
        `IOException`

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.