public class SolrIndex extends AbstractSearchIndex
LuceneSail
Modifier and Type | Field and Description |
---|---|
static String |
DISTANCE_FIELD |
static String |
SERVER_KEY |
maxDocs, wktFields
Constructor and Description |
---|
SolrIndex() |
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,
org.locationtech.spatial4j.shape.Shape shape,
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) |
accept, addDocuments, addRemoveStatements, addStatement, evaluate, evaluate, getResource, isGeoField, removeStatement
public static final String SERVER_KEY
public static final String DISTANCE_FIELD
public void initialize(Properties parameters) throws Exception
initialize
in interface SearchIndex
initialize
in class AbstractSearchIndex
Exception
protected com.google.common.base.Function<? super String,? extends org.locationtech.spatial4j.context.SpatialContext> createSpatialContextMapper(Map<String,String> parameters)
public org.apache.solr.client.solrj.SolrClient getClient()
protected org.locationtech.spatial4j.context.SpatialContext getSpatialContext(String property)
getSpatialContext
in class AbstractSearchIndex
public void shutDown() throws IOException
IOException
protected SearchDocument getDocument(String id) throws IOException
getDocument
in class AbstractSearchIndex
id
- IOException
protected Iterable<? extends SearchDocument> getDocuments(String resourceId) throws IOException
getDocuments
in class AbstractSearchIndex
IOException
protected SearchDocument newDocument(String id, String resourceId, String context)
newDocument
in class AbstractSearchIndex
protected SearchDocument copyDocument(SearchDocument doc)
copyDocument
in class AbstractSearchIndex
protected void addDocument(SearchDocument doc) throws IOException
addDocument
in class AbstractSearchIndex
IOException
protected void updateDocument(SearchDocument doc) throws IOException
updateDocument
in class AbstractSearchIndex
IOException
protected void deleteDocument(SearchDocument doc) throws IOException
deleteDocument
in class AbstractSearchIndex
IOException
protected BulkUpdater newBulkUpdate()
newBulkUpdate
in class AbstractSearchIndex
public SearchDocument getDocument(Resource subject, Resource context) throws IOException
subject
- context
- IOException
public Iterable<? extends SearchDocument> getDocuments(Resource subject) throws IOException
subject
- IOException
public static Set<String> getPropertyFields(Set<String> fields)
fields
- public void begin() throws IOException
SearchIndex
IOException
public void commit() throws IOException
SearchIndex
IOException
public void rollback() throws IOException
IOException
public void beginReading() throws IOException
IOException
public void endReading() throws IOException
IOException
@Deprecated protected SearchQuery parseQuery(String query, IRI propertyURI) throws MalformedQueryException
parseQuery
in class AbstractSearchIndex
query
- stringpropertyURI
- ParseException
- when the parsing brakesMalformedQueryException
protected Iterable<? extends DocumentScore> query(Resource subject, String query, IRI propertyURI, boolean highlight) throws MalformedQueryException, IOException
query
in class AbstractSearchIndex
subject
- query
- stringpropertyURI
- highlight
- MalformedQueryException
IOException
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
resource
- query
- org.apache.solr.client.solrj.SolrServerException
IOException
protected Iterable<? extends DocumentDistance> geoQuery(IRI geoProperty, org.locationtech.spatial4j.shape.Point p, IRI units, double distance, String distanceVar, Var contextVar) throws MalformedQueryException, IOException
geoQuery
in class AbstractSearchIndex
MalformedQueryException
IOException
protected Iterable<? extends DocumentResult> geoRelationQuery(String relation, IRI geoProperty, org.locationtech.spatial4j.shape.Shape shape, Var contextVar) throws MalformedQueryException, IOException
geoRelationQuery
in class AbstractSearchIndex
MalformedQueryException
IOException
protected org.locationtech.spatial4j.shape.Shape parseQueryShape(String property, String value) throws ParseException
parseQueryShape
in class AbstractSearchIndex
ParseException
protected String toWkt(org.locationtech.spatial4j.shape.Shape s)
public org.apache.solr.client.solrj.response.QueryResponse search(org.apache.solr.client.solrj.SolrQuery query) throws org.apache.solr.client.solrj.SolrServerException, IOException
query
- org.apache.solr.client.solrj.SolrServerException
IOException
public void clearContexts(Resource... contexts) throws IOException
SearchIndex
contexts
- IOException
public void clear() throws IOException
SearchIndex
IOException
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.