Class SolrIndex

All Implemented Interfaces:
SearchIndex

@Deprecated(since="5.3.0", forRemoval=true) public class SolrIndex extends AbstractSearchIndex
Deprecated, for removal: This API element is subject to removal in a future version.
since 5.3.0. Solr integration is deprecated for removal; use alternative Lucene-backed search implementations instead.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Fields inherited from class AbstractSearchIndex

    defaultNumDocs, maxDocs, wktFields
    Modifier and Type
    Field
    Description
    protected int
     
    protected int
     
    protected Set<String>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Begins a transaction.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Clears the indexes.
    void
    clearContexts(Resource... contexts)
    Deprecated, for removal: This API element is subject to removal in a future version.
    This should be called from within a begin-commit-rollback block.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    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/rolled back whenever the LuceneSailConnection is committed/rolled back.
    protected SearchDocument
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected com.google.common.base.Function<? super String, ? extends org.locationtech.spatial4j.context.SpatialContext>
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected Iterable<? extends DocumentDistance>
    geoQuery(IRI geoProperty, org.locationtech.spatial4j.shape.Point p, IRI units, double distance, String distanceVar, Var contextVar)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected Iterable<? extends DocumentResult>
    geoRelationQuery(String relation, IRI geoProperty, String wkt, Var contextVar)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    org.apache.solr.client.solrj.SolrClient
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected SearchDocument
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns a Document representing the specified document ID (combination of resource and context), or null when no such Document exists yet.
    getDocument(Resource subject, Resource context)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns a Document representing the specified Resource and Context combination, or null when no such Document exists yet.
    protected Iterable<? extends SearchDocument>
    getDocuments(String resourceId)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
    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
    static Set<String>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Filters the given list of fields, retaining all property fields.
    protected org.locationtech.spatial4j.context.SpatialContext
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    initialize(Properties parameters)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected BulkUpdater
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected SearchDocument
    newDocument(String id, String resourceId, String context)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected org.locationtech.spatial4j.shape.Shape
    parseQueryShape(String property, String value)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected Iterable<? extends DocumentScore>
    query(Resource subject, QuerySpec spec)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Parse the passed query.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    org.apache.solr.client.solrj.response.QueryResponse
    search(org.apache.solr.client.solrj.SolrQuery query)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Evaluates the given query and returns the results as a TopDocs instance.
    org.apache.solr.client.solrj.response.QueryResponse
    search(org.apache.solr.client.solrj.SolrQuery query, int numDocs)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Evaluates the given query and returns the results as a TopDocs instance.
    org.apache.solr.client.solrj.response.QueryResponse
    search(Resource resource, org.apache.solr.client.solrj.SolrQuery query)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Evaluates the given query only for the given resource.
    org.apache.solr.client.solrj.response.QueryResponse
    search(Resource resource, org.apache.solr.client.solrj.SolrQuery query, int numDocs)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Evaluates the given query only for the given resource.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected String
    toWkt(org.locationtech.spatial4j.shape.Shape s)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class AbstractSearchIndex

    accept, addDocuments, addRemoveStatements, addStatement, evaluate, getIndexedTypeMapping, getResource, isGeoField, isIndexedTypeStatement, isTypeFilteringEnabled, isTypeStatement, parseLuceneQueryShape, parseQueryPoint, removeStatement
    Modifier and Type
    Method
    Description
    boolean
    accept(Literal literal)
    Returns whether the provided literal is accepted by the LuceneIndex to be indexed.
    final void
    addDocuments(Resource subject, List<Statement> statements)
    Add a complete Lucene Document based on these statements.
    final void
    Add many statements at the same time, remove many statements at the same time.
    final void
    Indexes the specified Statement.
     
     
    protected Resource
    Returns the Resource corresponding with the specified Document.
    boolean
    isGeoField(String fieldName)
    Returns true if the given property contains a geometry.
    boolean
    Returns true if the given statement is a type statement of the right type, see LuceneSail.INDEXEDTYPES to use.
    boolean
    is the LuceneSail.INDEXEDTYPES parameter set for this index.
    boolean
    Returns true if the given statement is a type statement, see LuceneSail.INDEXEDTYPES to use.
    protected Object
     
    protected org.locationtech.spatial4j.shape.Shape
    parseQueryPoint(String property, String value)
     
    final void
    Removes the specified Statement from the indexes.This should be called from within a begin-commit-rollback

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SERVER_KEY

      public static final String SERVER_KEY
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
    • DISTANCE_FIELD

      public static final String DISTANCE_FIELD
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
  • Constructor Details

    • SolrIndex

      public SolrIndex()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • initialize

      public void initialize(Properties parameters) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      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)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getClient

      public org.apache.solr.client.solrj.SolrClient getClient()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getSpatialContext

      protected org.locationtech.spatial4j.context.SpatialContext getSpatialContext(String property)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getSpatialContext in class AbstractSearchIndex
    • shutDown

      public void shutDown() throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      IOException
    • getDocument

      protected SearchDocument getDocument(String id) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getDocuments in class AbstractSearchIndex
      Throws:
      IOException
    • newDocument

      protected SearchDocument newDocument(String id, String resourceId, String context)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      newDocument in class AbstractSearchIndex
    • copyDocument

      protected SearchDocument copyDocument(SearchDocument doc)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      copyDocument in class AbstractSearchIndex
    • addDocument

      protected void addDocument(SearchDocument doc) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      addDocument in class AbstractSearchIndex
      Throws:
      IOException
    • updateDocument

      protected void updateDocument(SearchDocument doc) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      updateDocument in class AbstractSearchIndex
      Throws:
      IOException
    • deleteDocument

      protected void deleteDocument(SearchDocument doc) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      deleteDocument in class AbstractSearchIndex
      Throws:
      IOException
    • newBulkUpdate

      protected BulkUpdater newBulkUpdate()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      newBulkUpdate in class AbstractSearchIndex
    • getDocument

      public SearchDocument getDocument(Resource subject, Resource context) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
      Deprecated, for removal: This API element is subject to removal in a future version.
      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)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Filters the given list of fields, retaining all property fields.
      Parameters:
      fields -
      Returns:
      set of fields
    • begin

      public void begin() throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: SearchIndex
      Begins a transaction.
      Throws:
      IOException
    • commit

      public void commit() throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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/rolled back whenever the LuceneSailConnection is committed/rolled back.
      Throws:
      IOException
    • rollback

      public void rollback() throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      IOException
    • query

      protected Iterable<? extends DocumentScore> query(Resource subject, QuerySpec spec) throws MalformedQueryException, IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parse the passed query.
      Specified by:
      query in class AbstractSearchIndex
      Parameters:
      subject -
      spec - query to process
      Returns:
      the parsed query
      Throws:
      MalformedQueryException
      IOException
      IllegalArgumentException - if the spec contains a multi-param query
    • 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
      Deprecated, for removal: This API element is subject to removal in a future version.
      Evaluates the given query only for the given resource.
      Parameters:
      resource -
      query -
      Returns:
      response
      Throws:
      org.apache.solr.client.solrj.SolrServerException
      IOException
    • search

      public org.apache.solr.client.solrj.response.QueryResponse search(Resource resource, org.apache.solr.client.solrj.SolrQuery query, int numDocs) throws org.apache.solr.client.solrj.SolrServerException, IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Evaluates the given query only for the given resource.
      Parameters:
      resource -
      query -
      numDocs -
      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
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      geoRelationQuery in class AbstractSearchIndex
      Throws:
      MalformedQueryException
      IOException
    • parseQueryShape

      protected org.locationtech.spatial4j.shape.Shape parseQueryShape(String property, String value) throws ParseException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      parseQueryShape in class AbstractSearchIndex
      Throws:
      ParseException
    • toWkt

      protected String toWkt(org.locationtech.spatial4j.shape.Shape s)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • 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
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
    • search

      public org.apache.solr.client.solrj.response.QueryResponse search(org.apache.solr.client.solrj.SolrQuery query, int numDocs) throws org.apache.solr.client.solrj.SolrServerException, IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Evaluates the given query and returns the results as a TopDocs instance.
      Parameters:
      query -
      numDocs -
      Returns:
      query response
      Throws:
      org.apache.solr.client.solrj.SolrServerException
      IOException
    • clearContexts

      public void clearContexts(Resource... contexts) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: SearchIndex
      Clears the indexes.
      Throws:
      IOException