Package ddf.catalog.source.solr
Class SolrMetacardClientImpl
java.lang.Object
ddf.catalog.source.solr.SolrMetacardClientImpl
- All Implemented Interfaces:
SolrMetacardClient
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSolrMetacardClientImpl(org.apache.solr.client.solrj.SolrClient client, ddf.catalog.filter.FilterAdapter catalogFilterAdapter, SolrFilterDelegateFactory solrFilterDelegateFactory, DynamicSchemaResolver dynamicSchemaResolver) -
Method Summary
Modifier and TypeMethodDescriptionList<org.apache.solr.common.SolrInputDocument> Adds a list ofMetacardobjects to Solr.createMetacard(org.apache.solr.common.SolrDocument doc) voiddeleteByIds(String fieldName, List<? extends Serializable> identifiers, boolean forceCommit) Deletes Solr documents by ID.voiddeleteByQuery(String query) Deletes all the Solr documents that match a specific query.org.apache.solr.client.solrj.SolrClientSet<ddf.catalog.data.ContentType> getIdentifierQuery(String fieldName, List<? extends Serializable> identifiers) List<ddf.catalog.data.Metacard> protected org.apache.solr.client.solrj.SolrQuerygetRealTimeQuery(org.apache.solr.client.solrj.SolrQuery originalQuery, Collection<String> ids) protected org.apache.solr.common.SolrInputDocumentgetSolrInputDocument(ddf.catalog.data.Metacard metacard) protected org.apache.solr.client.solrj.SolrQuerygetSolrQuery(ddf.catalog.operation.QueryRequest request, SolrFilterDelegate solrFilterDelegate) protected org.apache.solr.client.solrj.SolrQuerypostAdapt(ddf.catalog.operation.QueryRequest request, SolrFilterDelegate filterDelegate, org.apache.solr.client.solrj.SolrQuery query) ddf.catalog.operation.SourceResponsequery(ddf.catalog.operation.QueryRequest request) Converts aQueryRequestinto a Solr query and returns the result as aSourceResponse.List<ddf.catalog.data.Metacard> Runs a Solr query and converts the result as a list ofMetacardobjects.protected StringsetSortProperty(ddf.catalog.operation.QueryRequest request, org.apache.solr.client.solrj.SolrQuery query, SolrFilterDelegate solrFilterDelegate)
-
Field Details
-
RELEVANCE_SORT_FIELD
- See Also:
-
SORT_FIELD_KEY
- See Also:
-
POINT_KEY
- See Also:
-
SHOWING_RESULTS_FOR_KEY
- See Also:
-
DID_YOU_MEAN_KEY
- See Also:
-
SPELLCHECK_KEY
- See Also:
-
GET_BY_ID_LIMIT
public static final int GET_BY_ID_LIMIT- See Also:
-
DO_REALTIME_GET
- See Also:
-
SKIP_REALTIME_GET
- See Also:
-
highlighter
-
-
Constructor Details
-
SolrMetacardClientImpl
public SolrMetacardClientImpl(org.apache.solr.client.solrj.SolrClient client, ddf.catalog.filter.FilterAdapter catalogFilterAdapter, SolrFilterDelegateFactory solrFilterDelegateFactory, DynamicSchemaResolver dynamicSchemaResolver)
-
-
Method Details
-
getClient
public org.apache.solr.client.solrj.SolrClient getClient() -
query
public ddf.catalog.operation.SourceResponse query(ddf.catalog.operation.QueryRequest request) throws ddf.catalog.source.UnsupportedQueryException Description copied from interface:SolrMetacardClientConverts aQueryRequestinto a Solr query and returns the result as aSourceResponse.- Specified by:
queryin interfaceSolrMetacardClient- Parameters:
request- query request to execute against Solr- Returns:
- converted Solr response
- Throws:
ddf.catalog.source.UnsupportedQueryException- if the query is not supported
-
query
public List<ddf.catalog.data.Metacard> query(String queryString) throws ddf.catalog.source.UnsupportedQueryException Description copied from interface:SolrMetacardClientRuns a Solr query and converts the result as a list ofMetacardobjects.- Specified by:
queryin interfaceSolrMetacardClient- Parameters:
queryString- Solr query string- Returns:
- list of
Metacardobjects created from the Solr result - Throws:
ddf.catalog.source.UnsupportedQueryException- if the query is not supported, e.g., invalid query string
-
getIds
public List<ddf.catalog.data.Metacard> getIds(Set<String> ids) throws ddf.catalog.source.UnsupportedQueryException - Specified by:
getIdsin interfaceSolrMetacardClient- Throws:
ddf.catalog.source.UnsupportedQueryException
-
getContentTypes
- Specified by:
getContentTypesin interfaceSolrMetacardClient- Returns:
- set of supported content types.
-
getSolrQuery
protected org.apache.solr.client.solrj.SolrQuery getSolrQuery(ddf.catalog.operation.QueryRequest request, SolrFilterDelegate solrFilterDelegate) throws ddf.catalog.source.UnsupportedQueryException - Throws:
ddf.catalog.source.UnsupportedQueryException
-
getRealTimeQuery
protected org.apache.solr.client.solrj.SolrQuery getRealTimeQuery(org.apache.solr.client.solrj.SolrQuery originalQuery, Collection<String> ids) -
postAdapt
protected org.apache.solr.client.solrj.SolrQuery postAdapt(ddf.catalog.operation.QueryRequest request, SolrFilterDelegate filterDelegate, org.apache.solr.client.solrj.SolrQuery query) throws ddf.catalog.source.UnsupportedQueryException - Throws:
ddf.catalog.source.UnsupportedQueryException
-
setSortProperty
protected String setSortProperty(ddf.catalog.operation.QueryRequest request, org.apache.solr.client.solrj.SolrQuery query, SolrFilterDelegate solrFilterDelegate) -
createMetacard
public MetacardImpl createMetacard(org.apache.solr.common.SolrDocument doc) throws ddf.catalog.data.MetacardCreationException - Throws:
ddf.catalog.data.MetacardCreationException
-
add
public List<org.apache.solr.common.SolrInputDocument> add(List<ddf.catalog.data.Metacard> metacards, boolean forceAutoCommit) throws IOException, org.apache.solr.client.solrj.SolrServerException, ddf.catalog.data.MetacardCreationException Description copied from interface:SolrMetacardClientAdds a list ofMetacardobjects to Solr.- Specified by:
addin interfaceSolrMetacardClient- Parameters:
metacards- list ofMetacardobjects to addforceAutoCommit- force an auto-commit after the addition- Returns:
- list of documents added
- Throws:
IOException- if there is a communication error with the serverorg.apache.solr.client.solrj.SolrServerException- if there is an error on the serverddf.catalog.data.MetacardCreationException- if aMetacardcould not be created
-
getSolrInputDocument
protected org.apache.solr.common.SolrInputDocument getSolrInputDocument(ddf.catalog.data.Metacard metacard) throws ddf.catalog.data.MetacardCreationException - Throws:
ddf.catalog.data.MetacardCreationException
-
deleteByIds
public void deleteByIds(String fieldName, List<? extends Serializable> identifiers, boolean forceCommit) throws IOException, org.apache.solr.client.solrj.SolrServerException Description copied from interface:SolrMetacardClientDeletes Solr documents by ID.- Specified by:
deleteByIdsin interfaceSolrMetacardClient- Parameters:
fieldName- field name that contains the IDidentifiers- list of identifiers to deleteforceCommit- force an auto-commit after the deletion- Throws:
IOException- if there is a communication error with the serverorg.apache.solr.client.solrj.SolrServerException- if there is an error on the server
-
deleteByQuery
public void deleteByQuery(String query) throws IOException, org.apache.solr.client.solrj.SolrServerException Description copied from interface:SolrMetacardClientDeletes all the Solr documents that match a specific query.- Specified by:
deleteByQueryin interfaceSolrMetacardClient- Parameters:
query- Solr query string- Throws:
IOException- if there is a communication error with the serverorg.apache.solr.client.solrj.SolrServerException- if there is an error on the server
-
getIdentifierQuery
-