org.eclipse.rdf4j.sail.solr

## Class SolrIndex

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

- All Implemented Interfaces:
    SearchIndex

      public class SolrIndex
      extends AbstractSearchIndex

  See Also:
    `LuceneSail`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DISTANCE_FIELD`
    `static String` | `SERVER_KEY`

    - ### Fields inherited from class org.eclipse.rdf4j.sail.lucene.AbstractSearchIndex

      `maxDocs, wktFields`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SolrIndex()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addDocument(SearchDocument doc)`
    `void` | `begin()` Begins a transaction.
    `void` | `beginReading()`
    `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.The semantics is synchronous to SailConnection.commit(), i.e.
    `protected SearchDocument` | `copyDocument(SearchDocument doc)`
    `protected com.google.common.base.Function<? super String,? extends org.locationtech.spatial4j.context.SpatialContext>` | `createSpatialContextMapper(Map<String,String> parameters)`
    `protected void` | `deleteDocument(SearchDocument doc)`
    `void` | `endReading()`
    `protected Iterable<? extends DocumentDistance>` | `geoQuery(IRI geoProperty, org.locationtech.spatial4j.shape.Point p, IRI units, double distance, String distanceVar, Var contextVar)`
    `protected Iterable<? extends DocumentResult>` | `geoRelationQuery(String relation, IRI geoProperty, String wkt, Var contextVar)`
    `org.apache.solr.client.solrj.SolrClient` | `getClient()`
    `SearchDocument` | `getDocument(Resource subject, Resource context)` Returns a Document representing the specified Resource and Context combination, or null when no such Document exists yet.
    `protected SearchDocument` | `getDocument(String id)` Returns a Document representing the specified document ID (combination of resource and context), or null when no such Document exists yet.
    `Iterable<? extends SearchDocument>` | `getDocuments(Resource subject)` Returns a list of Documents representing the specified Resource (empty when no such Document exists yet).Each document represent a set of statements with the specified Resource as a subject, which are stored in a specific context
    `protected Iterable<? extends SearchDocument>` | `getDocuments(String resourceId)`
    `static Set<String>` | `getPropertyFields(Set<String> fields)` Filters the given list of fields, retaining all property fields.
    `protected org.locationtech.spatial4j.context.SpatialContext` | `getSpatialContext(String property)`
    `void` | `initialize(Properties parameters)`
    `protected BulkUpdater` | `newBulkUpdate()`
    `protected SearchDocument` | `newDocument(String id, String resourceId, String context)`
    `protected SearchQuery` | `parseQuery(String query, IRI propertyURI)` Deprecated.
    `protected org.locationtech.spatial4j.shape.Shape` | `parseQueryShape(String property, String value)`
    `protected Iterable<? extends DocumentScore>` | `query(Resource subject, String query, IRI propertyURI, boolean highlight)` Parse the passed query.
    `void` | `rollback()`
    `org.apache.solr.client.solrj.response.QueryResponse` | `search(Resource resource, org.apache.solr.client.solrj.SolrQuery query)` Evaluates the given query only for the given resource.
    `org.apache.solr.client.solrj.response.QueryResponse` | `search(org.apache.solr.client.solrj.SolrQuery query)` Evaluates the given query and returns the results as a TopDocs instance.
    `void` | `shutDown()`
    `protected String` | `toWkt(org.locationtech.spatial4j.shape.Shape s)`
    `protected void` | `updateDocument(SearchDocument doc)`

    - ### Methods inherited from class org.eclipse.rdf4j.sail.lucene.AbstractSearchIndex

      `accept, addDocuments, addRemoveStatements, addStatement, evaluate, evaluate, getResource, isGeoField, parseLuceneQueryShape, parseQueryPoint, removeStatement`

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

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

- - ### Field Detail

    - #### SERVER_KEY

          public static final String SERVER_KEY

      See Also:
        Constant Field Values

    - #### DISTANCE_FIELD

          public static final String DISTANCE_FIELD

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SolrIndex

          public SolrIndex()

  - ### Method Detail

    - #### initialize

          public void initialize(Properties parameters)
                          throws Exception

      Specified by:
        `initialize` in interface `SearchIndex`
      Overrides:
        `initialize` in class `AbstractSearchIndex`
      Throws:
        `Exception`

    - #### createSpatialContextMapper

          protected com.google.common.base.Function<? super String,? extends org.locationtech.spatial4j.context.SpatialContext> createSpatialContextMapper(Map<String,String> parameters)

    - #### getClient

          public org.apache.solr.client.solrj.SolrClient getClient()

    - #### getSpatialContext

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

      Specified by:
        `getSpatialContext` in class `AbstractSearchIndex`

    - #### shutDown

          public void shutDown()
                        throws IOException

      Throws:
        `IOException`

    - #### getDocument

          protected SearchDocument getDocument(String id)
                                        throws IOException

      Returns a Document representing the specified document ID (combination of resource and context), or null when no such Document exists yet.
      Specified by:
        `getDocument` in class `AbstractSearchIndex`
      Parameters:
        `id` -
      Returns:
        search document
      Throws:
        `IOException`

    - #### getDocuments

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

      Specified by:
        `getDocuments` in class `AbstractSearchIndex`
      Throws:
        `IOException`

    - #### newDocument

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

      Specified by:
        `newDocument` in class `AbstractSearchIndex`

    - #### copyDocument

          protected SearchDocument copyDocument(SearchDocument doc)

      Specified by:
        `copyDocument` in class `AbstractSearchIndex`

    - #### addDocument

          protected void addDocument(SearchDocument doc)
                              throws IOException

      Specified by:
        `addDocument` in class `AbstractSearchIndex`
      Throws:
        `IOException`

    - #### updateDocument

          protected void updateDocument(SearchDocument doc)
                                 throws IOException

      Specified by:
        `updateDocument` in class `AbstractSearchIndex`
      Throws:
        `IOException`

    - #### deleteDocument

          protected void deleteDocument(SearchDocument doc)
                                 throws IOException

      Specified by:
        `deleteDocument` in class `AbstractSearchIndex`
      Throws:
        `IOException`

    - #### newBulkUpdate

          protected BulkUpdater newBulkUpdate()

      Specified by:
        `newBulkUpdate` in class `AbstractSearchIndex`

    - #### getDocument

          public SearchDocument getDocument(Resource subject,
                                            Resource context)
                                     throws IOException

      Returns a Document representing the specified Resource and Context combination, or null when no such Document exists yet.
      Parameters:
        `subject` -
        `context` -
      Returns:
        search document
      Throws:
        `IOException`

    - #### getDocuments

          public Iterable<? extends SearchDocument> getDocuments(Resource subject)
                                                          throws IOException

      Returns a list of Documents representing the specified Resource (empty when no such Document exists yet).Each document represent a set of statements with the specified Resource as a subject, which are stored in a specific context
      Parameters:
        `subject` -
      Returns:
        list of documents
      Throws:
        `IOException`

    - #### getPropertyFields

          public static Set<String> getPropertyFields(Set<String> fields)

      Filters the given list of fields, retaining all property fields.
      Parameters:
        `fields` -
      Returns:
        set of fields

    - #### begin

          public void begin()
                     throws IOException

      Description copied from interface: `SearchIndex`
      Begins a transaction.
      Throws:
        `IOException`

    - #### commit

          public void commit()
                      throws IOException

      Description copied from interface: `SearchIndex`
      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

          public void rollback()
                        throws IOException

      Throws:
        `IOException`

    - #### beginReading

          public void beginReading()
                            throws IOException

      Throws:
        `IOException`

    - #### endReading

          public void endReading()
                          throws IOException

      Throws:
        `IOException`

    - #### parseQuery

          @Deprecated
          protected SearchQuery parseQuery(String query,
                                                       IRI propertyURI)
                                                throws MalformedQueryException

      Deprecated.
      Parse the passed query.To be removed, no longer used.
      Specified by:
        `parseQuery` in class `AbstractSearchIndex`
      Parameters:
        `query` - string
        `propertyURI` -
      Returns:
        the parsed query
      Throws:
        `ParseException` - when the parsing brakes
        `MalformedQueryException`

    - #### query

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

      Parse the passed query.
      Specified by:
        `query` in class `AbstractSearchIndex`
      Parameters:
        `subject` -
        `query` - string
        `propertyURI` -
        `highlight` -
      Returns:
        the parsed query
      Throws:
        `MalformedQueryException`
        `IOException`

    - #### search

          public org.apache.solr.client.solrj.response.QueryResponse search(Resource resource,
                                                                            org.apache.solr.client.solrj.SolrQuery query)
                                                                     throws org.apache.solr.client.solrj.SolrServerException,
                                                                            IOException

      Evaluates the given query only for the given resource.
      Parameters:
        `resource` -
        `query` -
      Returns:
        response
      Throws:
        `org.apache.solr.client.solrj.SolrServerException`
        `IOException`

    - #### geoQuery

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

      Specified by:
        `geoQuery` in class `AbstractSearchIndex`
      Throws:
        `MalformedQueryException`
        `IOException`

    - #### geoRelationQuery

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

      Specified by:
        `geoRelationQuery` in class `AbstractSearchIndex`
      Throws:
        `MalformedQueryException`
        `IOException`

    - #### parseQueryShape

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

      Overrides:
        `parseQueryShape` in class `AbstractSearchIndex`
      Throws:
        `ParseException`

    - #### toWkt

          protected String toWkt(org.locationtech.spatial4j.shape.Shape s)

    - #### search

          public org.apache.solr.client.solrj.response.QueryResponse search(org.apache.solr.client.solrj.SolrQuery query)
                                                                     throws org.apache.solr.client.solrj.SolrServerException,
                                                                            IOException

      Evaluates the given query and returns the results as a TopDocs instance.
      Parameters:
        `query` -
      Returns:
        query response
      Throws:
        `org.apache.solr.client.solrj.SolrServerException`
        `IOException`

    - #### clearContexts

          public void clearContexts(Resource... contexts)
                             throws IOException

      Description copied from interface: `SearchIndex`
      This should be called from within a begin-commit-rollback block.
      Parameters:
        `contexts` -
      Throws:
        `IOException`

    - #### clear

          public void clear()
                     throws IOException

      Description copied from interface: `SearchIndex`
      Clears the indexes.
      Throws:
        `IOException`

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