Example usage for org.apache.solr.common.params CommonParams OUTPUT_KEY

List of usage examples for org.apache.solr.common.params CommonParams OUTPUT_KEY

Introduction

In this page you can find the example usage for org.apache.solr.common.params CommonParams OUTPUT_KEY.

Prototype

String OUTPUT_KEY

To view the source code for org.apache.solr.common.params CommonParams OUTPUT_KEY.

Click Source Link

Usage

From source file:fi.nationallibrary.ndl.solr.request.RangeFieldFacets.java

License:Apache License

void parseParams(String type, String param) throws ParseException, IOException {
    localParams = QueryParsing.getLocalParams(param, req.getParams());
    base = docs;//from   ww  w . j av a 2s .com
    facetValue = param;
    key = param;

    if (localParams == null)
        return;

    // 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);

    // figure out if we need a new base DocSet
    String excludeStr = localParams.get(CommonParams.EXCLUDE);
    if (excludeStr == null)
        return;

    Map tagMap = (Map) req.getContext().get("tags");
    if (tagMap != null && rb != null) {
        List<String> excludeTagList = StrUtils.splitSmart(excludeStr, ',');

        IdentityHashMap<Query, Boolean> excludeSet = new IdentityHashMap<Query, Boolean>();
        for (String excludeTag : excludeTagList) {
            Object olst = tagMap.get(excludeTag);
            // tagMap has entries of List<String,List<QParser>>, but subject to change in the future
            if (!(olst instanceof Collection))
                continue;
            for (Object o : (Collection) olst) {
                if (!(o instanceof QParser))
                    continue;
                QParser qp = (QParser) o;
                excludeSet.put(qp.getQuery(), Boolean.TRUE);
            }
        }
        if (excludeSet.size() == 0)
            return;

        List<Query> qlist = new ArrayList<Query>();

        // add the base query
        if (!excludeSet.containsKey(rb.getQuery())) {
            qlist.add(rb.getQuery());
        }

        // add the filters
        if (rb.getFilters() != null) {
            for (Query q : rb.getFilters()) {
                if (!excludeSet.containsKey(q)) {
                    qlist.add(q);
                }
            }
        }

        // get the new base docset for this facet
        base = searcher.getDocSet(qlist);
    }

}

From source file:org.jahia.services.search.facets.SimpleJahiaJcrFacets.java

License:Open Source License

@SuppressWarnings("unused")
void parseParams(String type, String param) throws ParseException, IOException {
    // TODO: Should we activate that and how ? - we have no request object in backend        
    //        localParams = QueryParsing.getLocalParams(param, req.getParams());
    localParams = QueryParsing.getLocalParams(param, params);
    base = docs;/*from   w w w  . j a  va  2s.c o m*/
    facetValue = param;
    key = param;

    if (localParams == null)
        return;

    // remove local params unless it's a query
    if (!FacetParams.FACET_QUERY.equals(type)) {
        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);

    // figure out if we need a new base DocSet
    String excludeStr = localParams.get(CommonParams.EXCLUDE);
    if (excludeStr == null)
        return;

    // TODO: Should we activate that and how ? - we have no request object in backend
    //        Map tagMap = (Map)req.getContext().get("tags");
    /*if (tagMap != null && rb != null) {
      List<String> excludeTagList = StrUtils.splitSmart(excludeStr,',');
            
      IdentityHashMap<Query,Boolean> excludeSet = new IdentityHashMap<Query,Boolean>();
      for (String excludeTag : excludeTagList) {
    Object olst = tagMap.get(excludeTag);
    // tagMap has entries of List<String,List<QParser>>, but subject to change in the future
    if (!(olst instanceof Collection)) continue;
    for (Object o : (Collection<?>)olst) {
      if (!(o instanceof QParser)) continue;
      QParser qp = (QParser)o;
      excludeSet.put(qp.getQuery(), Boolean.TRUE);
    }
      }
      if (excludeSet.size() == 0) return;
            
      List<Query> qlist = new ArrayList<Query>();
            
      // add the base query
      if (!excludeSet.containsKey(rb.getQuery())) {
    qlist.add(rb.getQuery());
      }
            
      // add the filters
      if (rb.getFilters() != null) {
    for (Query q : rb.getFilters()) {
      if (!excludeSet.containsKey(q)) {
        qlist.add(q);
      }
    }
      }
            
      // get the new base docset for this facet
      base = getDocIdSet(qlist, "");
    }*/

}