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

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

Introduction

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

Prototype

int STAGE_PARSE_QUERY

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

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://  w w  w.ja v a 2 s  .co  m
 * 
 * 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);
    }
}