Example usage for org.apache.solr.handler.component ResponseBuilder STAGE_DONE

List of usage examples for org.apache.solr.handler.component ResponseBuilder STAGE_DONE

Introduction

In this page you can find the example usage for org.apache.solr.handler.component ResponseBuilder STAGE_DONE.

Prototype

int STAGE_DONE

To view the source code for org.apache.solr.handler.component ResponseBuilder STAGE_DONE.

Click Source Link

Usage

From source file:lux.solr.XQueryComponent.java

License:Mozilla Public License

/**
 * Process for a distributed search. This method is called at various stages
 * during the processing of a request:/*from www.  ja  v  a  2s  . c  om*/
 * 
 * During ResponseBuilder.STAGE_PARSE_QUERY we parse, optimize, compile and
 * execute the XQuery query. When a lux:search call is encountered, it will
 * create a SearchResultIterator, which creates a Lucene Query and calls
 * back into the SearchHandler; then subsequent phases are handled by the
 * normal QueryComponent.
 * 
 * @return the next stage for this component
 */
@Override
public int distributedProcess(ResponseBuilder rb) throws IOException {
    if (rb.grouping()) {
        throw new SolrException(ErrorCode.BAD_REQUEST, "Solr grouping not supported for XQuery");
    }
    if (rb.stage == ResponseBuilder.STAGE_PARSE_QUERY) {
        if (rb.req instanceof CloudQueryRequest) {
            CloudQueryRequest cloudReq = (CloudQueryRequest) rb.req;
            // the sort spec has already been generated
            rb.setSortSpec(cloudReq.getSortSpec());
            return ResponseBuilder.STAGE_EXECUTE_QUERY;
        } else {
            process(rb);
            return ResponseBuilder.STAGE_DONE;
        }
    } else {
        return super.distributedProcess(rb);
    }
}

From source file:org.alfresco.solr.component.AsyncBuildSuggestComponent.java

License:Open Source License

/** Dispatch shard request in <code>STAGE_EXECUTE_QUERY</code> stage */
@Override/*from   w ww  .j a v  a 2s. c  o m*/
public int distributedProcess(ResponseBuilder rb) {
    SolrParams params = rb.req.getParams();
    LOG.debug("SuggestComponent distributedProcess with : " + params);
    if (rb.stage < ResponseBuilder.STAGE_EXECUTE_QUERY)
        return ResponseBuilder.STAGE_EXECUTE_QUERY;
    if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) {
        ShardRequest sreq = new ShardRequest();
        sreq.purpose = ShardRequest.PURPOSE_GET_TOP_IDS;
        sreq.params = new ModifiableSolrParams(rb.req.getParams());
        sreq.params.remove(ShardParams.SHARDS);
        rb.addRequest(this, sreq);
        return ResponseBuilder.STAGE_GET_FIELDS;
    }

    return ResponseBuilder.STAGE_DONE;
}

From source file:org.tallison.solr.search.concordance.KeywordCooccurComponent.java

License:Apache License

@Override
public int distributedProcess(ResponseBuilder rb) throws IOException {
    if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS)
        process(rb); //run this locally instead of through the request pump

    return ResponseBuilder.STAGE_DONE;
}

From source file:org.tallison.solr.search.concordance.KWICComponent.java

License:Apache License

@Override
public int distributedProcess(ResponseBuilder rb) throws IOException {
    if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS)
        process(rb); //run this locally instead of throught he request pump

    return ResponseBuilder.STAGE_DONE;
}