예제 #1
0
 /**
  * Execute a search query
  *
  * @param solrQuery The solr query to perform
  * @param hasFacet Indicates whether the solr query has facets
  * @return The search result
  * @throws SolrServerException
  */
 private SolrSearchResult executeSearch(SolrQuery solrQuery, boolean hasFacet)
     throws SolrServerException {
   LOGGER.debug("Query to send to Solr: {}", solrQuery.toString());
   SolrServer solrServer = SolrManager.getInstance().getSolrServer();
   QueryResponse queryResponse = solrServer.query(solrQuery);
   if (hasFacet) {
     return new SolrSearchResult(queryResponse.getResults(), queryResponse.getFacetFields());
   } else {
     return new SolrSearchResult(queryResponse.getResults());
   }
 }
예제 #2
0
 /**
  * delete
  *
  * <p>Set the status of the given object to deleted
  *
  * @param fedoraObject The fedora object
  * @throws FedoraClientException
  */
 public void delete(FedoraObject fedoraObject) throws FedoraClientException {
   FedoraBroker.updateObjectState(fedoraObject.getObject_id(), "D");
   // Add this as a work around for the fact that commitWithin does not seem to work for
   // the Solr XML delete so we want to commit after delete
   SolrServer solrServer = SolrManager.getInstance().getSolrServer();
   try {
     solrServer.deleteById(fedoraObject.getObject_id(), 5000);
   } catch (IOException e) {
     LOGGER.debug("Exception committing delete", e);
   } catch (SolrServerException e) {
     LOGGER.debug("Exception committing delete", e);
   }
 }