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

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

Introduction

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

Prototype

public void setHighlightQuery(Query highlightQuery) 

Source Link

Usage

From source file:com.memonews.solr.handler.component.HighlightQueryComponent.java

License:Apache License

@Override
public void process(final ResponseBuilder rb) throws IOException {

    if (rb.doHighlights) {
        final SolrQueryRequest req = rb.req;
        final SolrParams params = req.getParams();
        final String qstr = params.get(CommonParams.Q);
        if (LOG.isDebugEnabled()) {
            LOG.info("Original query: " + qstr);
        }//  ww w . j a  va  2s  .  c o  m

        try {
            Query parsedQuery = parseAndCleanQuery(qstr, req, NAME);
            if (parsedQuery != null) {
                rb.setHighlightQuery(parsedQuery);
            }
        } catch (ParseException e1) {
            throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e1);
        }
    }
}