Class SolrIndex
java.lang.Object
org.eclipse.rdf4j.sail.lucene.AbstractSearchIndex
org.eclipse.rdf4j.sail.solr.SolrIndex
- All Implemented Interfaces:
SearchIndex
- See Also:
-
Field Summary
FieldsFields inherited from class AbstractSearchIndex
defaultNumDocs, maxDocs, wktFields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidbegin()Begins a transaction.voidclear()Clears the indexes.voidclearContexts(Resource... contexts) This should be called from within a begin-commit-rollback block.voidcommit()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 SearchDocumentprotected com.google.common.base.Function<? super String, ? extends org.locationtech.spatial4j.context.SpatialContext> createSpatialContextMapper(Map<String, String> parameters) protected voidprotected 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.SolrClientprotected SearchDocumentgetDocument(String id) 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) 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) 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 contextgetPropertyFields(Set<String> fields) Filters the given list of fields, retaining all property fields.protected org.locationtech.spatial4j.context.SpatialContextgetSpatialContext(String property) voidinitialize(Properties parameters) protected BulkUpdaterprotected SearchDocumentnewDocument(String id, String resourceId, String context) protected org.locationtech.spatial4j.shape.ShapeparseQueryShape(String property, String value) protected Iterable<? extends DocumentScore> Parse the passed query.voidrollback()org.apache.solr.client.solrj.response.QueryResponsesearch(org.apache.solr.client.solrj.SolrQuery query) Evaluates the given query and returns the results as a TopDocs instance.org.apache.solr.client.solrj.response.QueryResponsesearch(org.apache.solr.client.solrj.SolrQuery query, int numDocs) Evaluates the given query and returns the results as a TopDocs instance.org.apache.solr.client.solrj.response.QueryResponseEvaluates the given query only for the given resource.org.apache.solr.client.solrj.response.QueryResponseEvaluates the given query only for the given resource.voidshutDown()protected StringtoWkt(org.locationtech.spatial4j.shape.Shape s) protected void
-
Field Details
-
SERVER_KEY
- See Also:
-
DISTANCE_FIELD
- See Also:
-
-
Constructor Details
-
SolrIndex
public SolrIndex()
-
-
Method Details
-
initialize
- Specified by:
initializein interfaceSearchIndex- Overrides:
initializein classAbstractSearchIndex- Throws:
Exception
-
createSpatialContextMapper
-
getClient
public org.apache.solr.client.solrj.SolrClient getClient() -
getSpatialContext
- Specified by:
getSpatialContextin classAbstractSearchIndex
-
shutDown
- Throws:
IOException
-
getDocument
Returns a Document representing the specified document ID (combination of resource and context), or null when no such Document exists yet.- Specified by:
getDocumentin classAbstractSearchIndex- Parameters:
id-- Returns:
- search document
- Throws:
IOException
-
getDocuments
- Specified by:
getDocumentsin classAbstractSearchIndex- Throws:
IOException
-
newDocument
- Specified by:
newDocumentin classAbstractSearchIndex
-
copyDocument
- Specified by:
copyDocumentin classAbstractSearchIndex
-
addDocument
- Specified by:
addDocumentin classAbstractSearchIndex- Throws:
IOException
-
updateDocument
- Specified by:
updateDocumentin classAbstractSearchIndex- Throws:
IOException
-
deleteDocument
- Specified by:
deleteDocumentin classAbstractSearchIndex- Throws:
IOException
-
newBulkUpdate
- Specified by:
newBulkUpdatein classAbstractSearchIndex
-
getDocument
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
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
-
begin
-
commit
Description copied from interface:SearchIndexCommits 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
- Throws:
IOException
-
query
protected Iterable<? extends DocumentScore> query(Resource subject, QuerySpec spec) throws MalformedQueryException, IOException Parse the passed query.- Specified by:
queryin classAbstractSearchIndex- Parameters:
subject-spec- query to process- Returns:
- the parsed query
- Throws:
MalformedQueryExceptionIOExceptionIllegalArgumentException- 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 Evaluates the given query only for the given resource.- Parameters:
resource-query-- Returns:
- response
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
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 Evaluates the given query only for the given resource.- Parameters:
resource-query-numDocs-- Returns:
- response
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
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:
geoQueryin classAbstractSearchIndex- Throws:
MalformedQueryExceptionIOException
-
geoRelationQuery
protected Iterable<? extends DocumentResult> geoRelationQuery(String relation, IRI geoProperty, String wkt, Var contextVar) throws MalformedQueryException, IOException - Specified by:
geoRelationQueryin classAbstractSearchIndex- Throws:
MalformedQueryExceptionIOException
-
parseQueryShape
protected org.locationtech.spatial4j.shape.Shape parseQueryShape(String property, String value) throws ParseException - Overrides:
parseQueryShapein classAbstractSearchIndex- Throws:
ParseException
-
toWkt
-
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.SolrServerExceptionIOException
-
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 Evaluates the given query and returns the results as a TopDocs instance.- Parameters:
query-numDocs-- Returns:
- query response
- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
clearContexts
Description copied from interface:SearchIndexThis should be called from within a begin-commit-rollback block.- Parameters:
contexts-- Throws:
IOException
-
clear
-