public class SolrMetacardClientImpl extends Object implements SolrMetacardClient
Modifier and Type | Field and Description |
---|---|
static String |
EXCLUDE_ATTRIBUTES |
static String |
POINT_KEY |
protected static String |
RELEVANCE_SORT_FIELD |
static String |
SORT_FIELD_KEY |
Constructor and Description |
---|
SolrMetacardClientImpl(org.apache.solr.client.solrj.SolrClient client,
FilterAdapter catalogFilterAdapter,
SolrFilterDelegateFactory solrFilterDelegateFactory,
DynamicSchemaResolver dynamicSchemaResolver) |
Modifier and Type | Method and Description |
---|---|
List<org.apache.solr.common.SolrInputDocument> |
add(List<Metacard> metacards,
boolean forceAutoCommit)
Adds a list of
Metacard objects to Solr. |
MetacardImpl |
createMetacard(org.apache.solr.common.SolrDocument doc) |
void |
deleteByIds(String fieldName,
List<? extends Serializable> identifiers,
boolean forceCommit)
Deletes Solr documents by ID.
|
void |
deleteByQuery(String query)
Deletes all the Solr documents that match a specific query.
|
org.apache.solr.client.solrj.SolrClient |
getClient() |
Set<ContentType> |
getContentTypes() |
String |
getIdentifierQuery(String fieldName,
List<? extends Serializable> identifiers) |
protected org.apache.solr.common.SolrInputDocument |
getSolrInputDocument(Metacard metacard) |
protected org.apache.solr.client.solrj.SolrQuery |
getSolrQuery(QueryRequest request,
SolrFilterDelegate solrFilterDelegate) |
protected org.apache.solr.client.solrj.SolrQuery |
postAdapt(QueryRequest request,
SolrFilterDelegate filterDelegate,
org.apache.solr.client.solrj.SolrQuery query) |
SourceResponse |
query(QueryRequest request)
Converts a
QueryRequest into a Solr query and returns the result as a SourceResponse . |
List<Metacard> |
query(String queryString)
Runs a Solr query and converts the result as a list of
Metacard objects. |
protected String |
setSortProperty(QueryRequest request,
org.apache.solr.client.solrj.SolrQuery query,
SolrFilterDelegate solrFilterDelegate) |
protected static final String RELEVANCE_SORT_FIELD
public static final String SORT_FIELD_KEY
public static final String POINT_KEY
public static final String EXCLUDE_ATTRIBUTES
public SolrMetacardClientImpl(org.apache.solr.client.solrj.SolrClient client, FilterAdapter catalogFilterAdapter, SolrFilterDelegateFactory solrFilterDelegateFactory, DynamicSchemaResolver dynamicSchemaResolver)
public org.apache.solr.client.solrj.SolrClient getClient()
public SourceResponse query(QueryRequest request) throws UnsupportedQueryException
SolrMetacardClient
QueryRequest
into a Solr query and returns the result as a SourceResponse
.query
in interface SolrMetacardClient
request
- query request to execute against SolrUnsupportedQueryException
- if the query is not supportedpublic List<Metacard> query(String queryString) throws UnsupportedQueryException
SolrMetacardClient
Metacard
objects.query
in interface SolrMetacardClient
queryString
- Solr query stringMetacard
objects created from the Solr resultUnsupportedQueryException
- if the query is not supported, e.g., invalid query stringpublic Set<ContentType> getContentTypes()
getContentTypes
in interface SolrMetacardClient
protected org.apache.solr.client.solrj.SolrQuery getSolrQuery(QueryRequest request, SolrFilterDelegate solrFilterDelegate) throws UnsupportedQueryException
UnsupportedQueryException
protected org.apache.solr.client.solrj.SolrQuery postAdapt(QueryRequest request, SolrFilterDelegate filterDelegate, org.apache.solr.client.solrj.SolrQuery query) throws UnsupportedQueryException
UnsupportedQueryException
protected String setSortProperty(QueryRequest request, org.apache.solr.client.solrj.SolrQuery query, SolrFilterDelegate solrFilterDelegate)
public MetacardImpl createMetacard(org.apache.solr.common.SolrDocument doc) throws MetacardCreationException
MetacardCreationException
public List<org.apache.solr.common.SolrInputDocument> add(List<Metacard> metacards, boolean forceAutoCommit) throws IOException, org.apache.solr.client.solrj.SolrServerException, MetacardCreationException
SolrMetacardClient
Metacard
objects to Solr.add
in interface SolrMetacardClient
metacards
- list of Metacard
objects to addforceAutoCommit
- force an auto-commit after the additionIOException
- if there is a communication error with the serverorg.apache.solr.client.solrj.SolrServerException
- if there is an error on the serverMetacardCreationException
- if a Metacard
could not be createdprotected org.apache.solr.common.SolrInputDocument getSolrInputDocument(Metacard metacard) throws MetacardCreationException
MetacardCreationException
public void deleteByIds(String fieldName, List<? extends Serializable> identifiers, boolean forceCommit) throws IOException, org.apache.solr.client.solrj.SolrServerException
SolrMetacardClient
deleteByIds
in interface SolrMetacardClient
fieldName
- field name that contains the IDidentifiers
- list of identifiers to deleteforceCommit
- force an auto-commit after the deletionIOException
- if there is a communication error with the serverorg.apache.solr.client.solrj.SolrServerException
- if there is an error on the serverpublic void deleteByQuery(String query) throws IOException, org.apache.solr.client.solrj.SolrServerException
SolrMetacardClient
deleteByQuery
in interface SolrMetacardClient
query
- Solr query stringIOException
- if there is a communication error with the serverorg.apache.solr.client.solrj.SolrServerException
- if there is an error on the serverpublic String getIdentifierQuery(String fieldName, List<? extends Serializable> identifiers)
This work is licensed under a Creative Commons Attribution 4.0 International License.