Search in sources :

Example 1 with RequiredSolrParams

use of org.apache.solr.common.params.RequiredSolrParams in project lucene-solr by apache.

the class SimpleFacets method parseParams.

protected ParsedParams parseParams(String type, String param) throws SyntaxError, IOException {
    SolrParams localParams = QueryParsing.getLocalParams(param, req.getParams());
    DocSet docs = docsOrig;
    String facetValue = param;
    String key = param;
    List<String> tags = Collections.emptyList();
    int threads = -1;
    if (localParams == null) {
        SolrParams params = global;
        SolrParams required = new RequiredSolrParams(params);
        return new ParsedParams(localParams, params, required, facetValue, docs, key, tags, threads);
    }
    SolrParams params = SolrParams.wrapDefaults(localParams, global);
    SolrParams required = new RequiredSolrParams(params);
    // remove local params unless it's a query
    if (type != FacetParams.FACET_QUERY) {
        // TODO Cut over to an Enum here
        facetValue = localParams.get(CommonParams.VALUE);
    }
    // reset set the default key now that localParams have been removed
    key = facetValue;
    // allow explicit set of the key
    key = localParams.get(CommonParams.OUTPUT_KEY, key);
    String tagStr = localParams.get(CommonParams.TAG);
    tags = tagStr == null ? Collections.<String>emptyList() : StrUtils.splitSmart(tagStr, ',');
    String threadStr = localParams.get(CommonParams.THREADS);
    if (threadStr != null) {
        threads = Integer.parseInt(threadStr);
    }
    // figure out if we need a new base DocSet
    String excludeStr = localParams.get(CommonParams.EXCLUDE);
    if (excludeStr == null)
        return new ParsedParams(localParams, params, required, facetValue, docs, key, tags, threads);
    List<String> excludeTagList = StrUtils.splitSmart(excludeStr, ',');
    docs = computeDocSet(docs, excludeTagList);
    return new ParsedParams(localParams, params, required, facetValue, docs, key, tags, threads);
}
Also used : RequiredSolrParams(org.apache.solr.common.params.RequiredSolrParams) RequiredSolrParams(org.apache.solr.common.params.RequiredSolrParams) SolrParams(org.apache.solr.common.params.SolrParams) HashDocSet(org.apache.solr.search.HashDocSet) DocSet(org.apache.solr.search.DocSet) SortedIntDocSet(org.apache.solr.search.SortedIntDocSet) BitDocSet(org.apache.solr.search.BitDocSet)

Example 2 with RequiredSolrParams

use of org.apache.solr.common.params.RequiredSolrParams in project lucene-solr by apache.

the class LegacyFacet method parseParams.

protected void parseParams(String type, String param) {
    facetValue = param;
    key = param;
    try {
        localParams = QueryParsing.getLocalParams(param, orig);
        if (localParams == null) {
            params = orig;
            required = new RequiredSolrParams(params);
            // setupStats();
            return;
        }
        params = SolrParams.wrapDefaults(localParams, orig);
        required = new RequiredSolrParams(params);
        // remove local params unless it's a query
        if (type != FacetParams.FACET_QUERY) {
            facetValue = localParams.get(CommonParams.VALUE);
        }
        // reset set the default key now that localParams have been removed
        key = facetValue;
        // allow explicit set of the key
        key = localParams.get(CommonParams.OUTPUT_KEY, key);
    // setupStats();
    } catch (SyntaxError e) {
        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
    }
}
Also used : RequiredSolrParams(org.apache.solr.common.params.RequiredSolrParams) SyntaxError(org.apache.solr.search.SyntaxError) SolrException(org.apache.solr.common.SolrException)

Example 3 with RequiredSolrParams

use of org.apache.solr.common.params.RequiredSolrParams in project lucene-solr by apache.

the class PivotFacetProcessor method getParsedParams.

private ParsedParams getParsedParams(SolrParams params, DocSet docs, FacetComponent.FacetBase facet) {
    SolrParams wrapped = SolrParams.wrapDefaults(facet.localParams, global);
    SolrParams required = new RequiredSolrParams(params);
    return new ParsedParams(facet.localParams, wrapped, required, facet.facetOn, docs, facet.getKey(), facet.getTags(), -1);
}
Also used : RequiredSolrParams(org.apache.solr.common.params.RequiredSolrParams) RequiredSolrParams(org.apache.solr.common.params.RequiredSolrParams) SolrParams(org.apache.solr.common.params.SolrParams)

Aggregations

RequiredSolrParams (org.apache.solr.common.params.RequiredSolrParams)3 SolrParams (org.apache.solr.common.params.SolrParams)2 SolrException (org.apache.solr.common.SolrException)1 BitDocSet (org.apache.solr.search.BitDocSet)1 DocSet (org.apache.solr.search.DocSet)1 HashDocSet (org.apache.solr.search.HashDocSet)1 SortedIntDocSet (org.apache.solr.search.SortedIntDocSet)1 SyntaxError (org.apache.solr.search.SyntaxError)1