Example usage for org.apache.solr.handler.component ShardRequest PURPOSE_GET_TOP_GROUPS

List of usage examples for org.apache.solr.handler.component ShardRequest PURPOSE_GET_TOP_GROUPS

Introduction

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

Prototype

int PURPOSE_GET_TOP_GROUPS

To view the source code for org.apache.solr.handler.component ShardRequest PURPOSE_GET_TOP_GROUPS.

Click Source Link

Usage

From source file:org.dice.solrenhancements.spellchecker.DiceSpellCheckComponent.java

License:Apache License

@Override
public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) {
    SolrParams params = rb.req.getParams();
    if (!params.getBool(COMPONENT_NAME, false))
        return;/*  www. j  a  v  a 2 s . c  o m*/
    int purpose = rb.grouping() ? ShardRequest.PURPOSE_GET_TOP_GROUPS : ShardRequest.PURPOSE_GET_TOP_IDS;
    if ((sreq.purpose & purpose) != 0) {
        // fetch at least 5 suggestions from each shard
        int count = sreq.params.getInt(SPELLCHECK_COUNT, 1);
        if (count < 5)
            count = 5;
        sreq.params.set(SPELLCHECK_COUNT, count);
        sreq.params.set("spellcheck", "true");
    } else {
        sreq.params.set("spellcheck", "false");
    }
}