コード例 #1
0
  @Override
  public void finishStage(ResponseBuilder rb) {
    if (!rb.doTerms || rb.stage != ResponseBuilder.STAGE_EXECUTE_QUERY) {
      return;
    }

    TermsHelper ti = rb._termsHelper;
    NamedList terms = ti.buildResponse();

    rb.rsp.add("terms", terms);
    rb._termsHelper = null;
  }
コード例 #2
0
 @Override
 public void handleResponses(ResponseBuilder rb, ShardRequest sreq) {
   if (!rb.doTerms || (sreq.purpose & ShardRequest.PURPOSE_GET_TERMS) == 0) {
     return;
   }
   TermsHelper th = rb._termsHelper;
   if (th != null) {
     for (ShardResponse srsp : sreq.responses) {
       th.parse((NamedList) srsp.getSolrResponse().getResponse().get("terms"));
     }
   }
 }
コード例 #3
0
 @Override
 public void handleResponses(ResponseBuilder rb, ShardRequest sreq) {
   if (!rb.doTerms || (sreq.purpose & ShardRequest.PURPOSE_GET_TERMS) == 0) {
     return;
   }
   TermsHelper th = rb._termsHelper;
   if (th != null) {
     for (ShardResponse srsp : sreq.responses) {
       @SuppressWarnings("unchecked")
       NamedList<NamedList<Number>> terms =
           (NamedList<NamedList<Number>>) srsp.getSolrResponse().getResponse().get("terms");
       th.parse(terms);
     }
   }
 }
コード例 #4
0
  @Override
  public int distributedProcess(ResponseBuilder rb) throws IOException {
    if (!rb.doTerms) {
      return ResponseBuilder.STAGE_DONE;
    }

    if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) {
      TermsHelper th = rb._termsHelper;
      if (th == null) {
        th = rb._termsHelper = new TermsHelper();
        th.init(rb.req.getParams());
      }
      ShardRequest sreq = createShardQuery(rb.req.getParams());
      rb.addRequest(this, sreq);
    }

    if (rb.stage < ResponseBuilder.STAGE_EXECUTE_QUERY) {
      return ResponseBuilder.STAGE_EXECUTE_QUERY;
    } else {
      return ResponseBuilder.STAGE_DONE;
    }
  }