org.eclipse.rdf4j.sail.lucene

## Class AbstractSearchIndex

- java.lang.Object
- - org.eclipse.rdf4j.sail.lucene.AbstractSearchIndex

- All Implemented Interfaces:
    SearchIndex
  Direct Known Subclasses:
    AbstractLuceneIndex, ElasticsearchIndex, SolrIndex

      public abstract class AbstractSearchIndex
      extends Object
      implements SearchIndex

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `maxDocs`
    `protected Set<String>` | `wktFields`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractSearchIndex()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete 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.
    `protected abstract void` | `addDocument(SearchDocument doc)`
    `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.
    `protected abstract SearchDocument` | `copyDocument(SearchDocument doc)`
    `protected abstract void` | `deleteDocument(SearchDocument doc)`
    `Collection<BindingSet>` | `evaluate(QuerySpec query)` Deprecated.
    `Collection<BindingSet>` | `evaluate(SearchQueryEvaluator evaluator)`
    `protected abstract Iterable<? extends DocumentDistance>` | `geoQuery(IRI geoProperty, org.locationtech.spatial4j.shape.Point p, IRI units, double distance, String distanceVar, Var context)`
    `protected abstract Iterable<? extends DocumentResult>` | `geoRelationQuery(String relation, IRI geoProperty, String wkt, Var context)`
    `protected abstract SearchDocument` | `getDocument(String id)`
    `protected abstract Iterable<? extends SearchDocument>` | `getDocuments(String resourceId)`
    `protected Resource` | `getResource(SearchDocument document)` Returns the Resource corresponding with the specified Document.
    `protected abstract org.locationtech.spatial4j.context.SpatialContext` | `getSpatialContext(String property)`
    `void` | `initialize(Properties parameters)`
    `boolean` | `isGeoField(String fieldName)` Returns true if the given property contains a geometry.
    `protected abstract BulkUpdater` | `newBulkUpdate()`
    `protected abstract SearchDocument` | `newDocument(String id, String resourceId, String context)`
    `protected Object` | `parseLuceneQueryShape(String property, String value)`
    `protected abstract SearchQuery` | `parseQuery(String q, IRI property)` Deprecated.
    `protected org.locationtech.spatial4j.shape.Shape` | `parseQueryPoint(String property, String value)`
    `protected org.locationtech.spatial4j.shape.Shape` | `parseQueryShape(String property, String value)`
    `protected abstract Iterable<? extends DocumentScore>` | `query(Resource subject, String q, IRI property, boolean highlight)`
    `void` | `removeStatement(Statement statement)` Removes the specified Statement from the indexes.This should be called from within a begin-commit-rollback block.
    `protected abstract void` | `updateDocument(SearchDocument doc)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.sail.lucene.SearchIndex

      `begin, beginReading, clear, clearContexts, commit, endReading, rollback, shutDown`

- - ### Field Detail

    - #### maxDocs

          protected int maxDocs

    - #### wktFields

          protected Set<String> wktFields

  - ### Constructor Detail

    - #### AbstractSearchIndex

          public AbstractSearchIndex()

  - ### Method Detail

    - #### initialize

          public void initialize(Properties parameters)
                          throws Exception

      Specified by:
        `initialize` in interface `SearchIndex`
      Throws:
        `Exception`

    - #### getSpatialContext

          protected abstract org.locationtech.spatial4j.context.SpatialContext getSpatialContext(String property)

    - #### accept

          public 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.
      Specified by:
        `accept` in interface `SearchIndex`
      Parameters:
        `literal` - the literal to be accepted
      Returns:
        true if the given literal will be indexed by this LuceneIndex

    - #### isGeoField

          public boolean isGeoField(String fieldName)

      Description copied from interface: `SearchIndex`
      Returns true if the given property contains a geometry.
      Specified by:
        `isGeoField` in interface `SearchIndex`
      Returns:
        boolean

    - #### addStatement

          public final void addStatement(Statement statement)
                                  throws IOException

      Indexes the specified Statement.
      Specified by:
        `addStatement` in interface `SearchIndex`
      Throws:
        `IOException`

    - #### removeStatement

          public final void removeStatement(Statement statement)
                                     throws IOException

      Description copied from interface: `SearchIndex`
      Removes the specified Statement from the indexes.This should be called from within a begin-commit-rollback block.
      Specified by:
        `removeStatement` in interface `SearchIndex`
      Throws:
        `IOException`

    - #### addRemoveStatements

          public final 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
      Specified by:
        `addRemoveStatements` in interface `SearchIndex`
      Parameters:
        `added` - all added statements, can have multiple subjects
        `removed` - all removed statements, can have multiple subjects
      Throws:
        `IOException`

    - #### addDocuments

          public final 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)
      Specified by:
        `addDocuments` in interface `SearchIndex`
      Parameters:
        `statements` - the statements that make up the resource
      Throws:
        `IOException`

    - #### evaluate

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

      Deprecated.
      To be removed, prefer `evaluate(SearchQueryEvaluator)`.
      Specified by:
        `evaluate` in interface `SearchIndex`
      Throws:
        `SailException`

    - #### evaluate

          public final Collection<BindingSet> evaluate(SearchQueryEvaluator evaluator)
                                                throws SailException

      Specified by:
        `evaluate` in interface `SearchIndex`
      Throws:
        `SailException`

    - #### parseLuceneQueryShape

          protected Object parseLuceneQueryShape(String property,
                                                 String value)
                                          throws ParseException,
                                                 IOException

      Throws:
        `ParseException`
        `IOException`

    - #### parseQueryShape

          protected org.locationtech.spatial4j.shape.Shape parseQueryShape(String property,
                                                                           String value)
                                                                    throws ParseException

      Throws:
        `ParseException`

    - #### parseQueryPoint

          protected org.locationtech.spatial4j.shape.Shape parseQueryPoint(String property,
                                                                           String value)
                                                                    throws ParseException

      Throws:
        `ParseException`

    - #### getResource

          protected Resource getResource(SearchDocument document)

      Returns the Resource corresponding with the specified Document.

    - #### getDocument

          protected abstract SearchDocument getDocument(String id)
                                                 throws IOException

      Throws:
        `IOException`

    - #### getDocuments

          protected abstract Iterable<? extends SearchDocument> getDocuments(String resourceId)
                                                                      throws IOException

      Throws:
        `IOException`

    - #### newDocument

          protected abstract SearchDocument newDocument(String id,
                                                        String resourceId,
                                                        String context)

    - #### copyDocument

          protected abstract SearchDocument copyDocument(SearchDocument doc)

    - #### addDocument

          protected abstract void addDocument(SearchDocument doc)
                                       throws IOException

      Throws:
        `IOException`

    - #### updateDocument

          protected abstract void updateDocument(SearchDocument doc)
                                          throws IOException

      Throws:
        `IOException`

    - #### deleteDocument

          protected abstract void deleteDocument(SearchDocument doc)
                                          throws IOException

      Throws:
        `IOException`

    - #### parseQuery

          @Deprecated
          protected abstract SearchQuery parseQuery(String q,
                                                                IRI property)
                                                         throws MalformedQueryException

      Deprecated.
      To be removed.
      Throws:
        `MalformedQueryException`

    - #### query

          protected abstract Iterable<? extends DocumentScore> query(Resource subject,
                                                                     String q,
                                                                     IRI property,
                                                                     boolean highlight)
                                                              throws MalformedQueryException,
                                                                     IOException

      Throws:
        `MalformedQueryException`
        `IOException`

    - #### geoQuery

          protected abstract Iterable<? extends DocumentDistance> geoQuery(IRI geoProperty,
                                                                           org.locationtech.spatial4j.shape.Point p,
                                                                           IRI units,
                                                                           double distance,
                                                                           String distanceVar,
                                                                           Var context)
                                                                    throws MalformedQueryException,
                                                                           IOException

      Throws:
        `MalformedQueryException`
        `IOException`

    - #### geoRelationQuery

          protected abstract Iterable<? extends DocumentResult> geoRelationQuery(String relation,
                                                                                 IRI geoProperty,
                                                                                 String wkt,
                                                                                 Var context)
                                                                          throws MalformedQueryException,
                                                                                 IOException

      Throws:
        `MalformedQueryException`
        `IOException`

    - #### newBulkUpdate

          protected abstract BulkUpdater newBulkUpdate()

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