Esempio n. 1
0
 public boolean execute() {
   SolrQuery query = queryGenerator.generate();
   try {
     logger.debug("executing query: " + query);
     long init = System.nanoTime();
     QueryResponse response = this.executeQuery(query);
     long clientTime = (System.nanoTime() - init) / 1000000;
     logger.debug(
         response.getResults().getNumFound() + " results found in " + response.getQTime() + " ms");
     if (response.getQTime() < 0) {
       throw new RuntimeException(
           "The query returned less than 0 as q time: "
               + response.getResponseHeader().get("q")
               + response.getQTime());
     }
     executor.notifyQueryExecuted(response, clientTime);
   } catch (SolrServerException e) {
     logger.error("Error on Query " + query);
     e.printStackTrace();
     executor.notifyError(new QueryException(e, query));
     return false;
   }
   return true;
 }
Esempio n. 2
0
 protected QueryResponse executeQuery(SolrQuery query) throws SolrServerException {
   String requestMethod =
       SolrMeterConfiguration.getProperty(SolrMeterConfiguration.QUERY_METHOD, "GET");
   return executor.getSolrServer().query(query, METHOD.valueOf(requestMethod));
 }