Class SolrMetacardClientImpl

java.lang.Object
ddf.catalog.source.solr.SolrMetacardClientImpl
All Implemented Interfaces:
SolrMetacardClient

public class SolrMetacardClientImpl extends Object implements SolrMetacardClient
  • Field Details

  • 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: SolrMetacardClient
      Converts a QueryRequest into a Solr query and returns the result as a SourceResponse.
      Specified by:
      query in interface SolrMetacardClient
      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: SolrMetacardClient
      Runs a Solr query and converts the result as a list of Metacard objects.
      Specified by:
      query in interface SolrMetacardClient
      Parameters:
      queryString - Solr query string
      Returns:
      list of Metacard objects 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:
      getIds in interface SolrMetacardClient
      Throws:
      ddf.catalog.source.UnsupportedQueryException
    • getContentTypes

      public Set<ddf.catalog.data.ContentType> getContentTypes()
      Specified by:
      getContentTypes in interface SolrMetacardClient
      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: SolrMetacardClient
      Adds a list of Metacard objects to Solr.
      Specified by:
      add in interface SolrMetacardClient
      Parameters:
      metacards - list of Metacard objects to add
      forceAutoCommit - force an auto-commit after the addition
      Returns:
      list of documents added
      Throws:
      IOException - if there is a communication error with the server
      org.apache.solr.client.solrj.SolrServerException - if there is an error on the server
      ddf.catalog.data.MetacardCreationException - if a Metacard could 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: SolrMetacardClient
      Deletes Solr documents by ID.
      Specified by:
      deleteByIds in interface SolrMetacardClient
      Parameters:
      fieldName - field name that contains the ID
      identifiers - list of identifiers to delete
      forceCommit - force an auto-commit after the deletion
      Throws:
      IOException - if there is a communication error with the server
      org.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: SolrMetacardClient
      Deletes all the Solr documents that match a specific query.
      Specified by:
      deleteByQuery in interface SolrMetacardClient
      Parameters:
      query - Solr query string
      Throws:
      IOException - if there is a communication error with the server
      org.apache.solr.client.solrj.SolrServerException - if there is an error on the server
    • getIdentifierQuery

      public String getIdentifierQuery(String fieldName, List<? extends Serializable> identifiers)