当前位置: 首页>>代码示例>>Java>>正文


Java QueryParsing.getLocalParams方法代码示例

本文整理汇总了Java中org.apache.solr.search.QueryParsing.getLocalParams方法的典型用法代码示例。如果您正苦于以下问题:Java QueryParsing.getLocalParams方法的具体用法?Java QueryParsing.getLocalParams怎么用?Java QueryParsing.getLocalParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.search.QueryParsing的用法示例。


在下文中一共展示了QueryParsing.getLocalParams方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FacetBase

import org.apache.solr.search.QueryParsing; //导入方法依赖的package包/类
public FacetBase(ResponseBuilder rb, String facetType, String facetStr) {
  this.facetType = facetType;
  this.facetStr = facetStr;
  try {
    this.localParams = QueryParsing.getLocalParams(facetStr,
                                                   rb.req.getParams());
  } catch (SyntaxError e) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
  }
  this.facetOn = facetStr;
  this.key = facetStr;
  
  if (localParams != null) {
    // remove local params unless it's a query
    if (!facetType.equals(FacetParams.FACET_QUERY)) {
      facetOn = localParams.get(CommonParams.VALUE);
      key = facetOn;
    }
    
    key = localParams.get(CommonParams.OUTPUT_KEY, key);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:FacetComponent.java

示例2: FacetBase

import org.apache.solr.search.QueryParsing; //导入方法依赖的package包/类
public FacetBase(ResponseBuilder rb, String facetType, String facetStr) {
  this.facetType = facetType;
  this.facetStr = facetStr;
  try {
    this.localParams = QueryParsing.getLocalParams(facetStr, rb.req.getParams());
  } catch (SyntaxError e) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
  }
  this.facetOn = facetStr;
  this.key = facetStr;

  if (localParams != null) {
    // remove local params unless it's a query
    if (!facetType.equals(FacetParams.FACET_QUERY)) {
      facetOn = localParams.get(CommonParams.VALUE);
      key = facetOn;
    }

    key = localParams.get(CommonParams.OUTPUT_KEY, key);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:22,代码来源:FacetComponent.java

示例3: FacetBase

import org.apache.solr.search.QueryParsing; //导入方法依赖的package包/类
public FacetBase(ResponseBuilder rb, String facetType, String facetStr) {
  this.facetType = facetType;
  this.facetStr = facetStr;
  try {
    this.localParams = QueryParsing.getLocalParams(facetStr,
                                                   rb.req.getParams());
  } catch (SyntaxError e) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
  }
  this.facetOn = facetStr;
  this.key = facetStr;
  
  if (localParams != null) {
    // remove local params unless it's a query
    if (!facetType.equals(FacetParams.FACET_QUERY)) {
      facetOn = localParams.get(CommonParams.VALUE);
      key = facetOn;
    }
    
    key = localParams.get(CommonParams.OUTPUT_KEY, key);

    String tagStr = localParams.get(CommonParams.TAG);
    this.tags = tagStr == null ? Collections.<String>emptyList() : StrUtils.splitSmart(tagStr,',');

    String threadStr = localParams.get(CommonParams.THREADS);
    this.threadCount = threadStr != null ? Integer.parseInt(threadStr) : -1;

    String excludeStr = localParams.get(CommonParams.EXCLUDE);
    if (StringUtils.isEmpty(excludeStr))  {
      this.excludeTags = Collections.emptyList();
    } else {
      this.excludeTags = StrUtils.splitSmart(excludeStr,',');
    }
  }
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:36,代码来源:FacetComponent.java

示例4: parseParams

import org.apache.solr.search.QueryParsing; //导入方法依赖的package包/类
protected void parseParams(String param) throws SyntaxError, IOException {
  localParams = QueryParsing.getLocalParams(param, req.getParams());
  base = docs;
  statsField = param;
  key = param;

  if (localParams == null) return;

  statsField = localParams.get(CommonParams.VALUE);

  // reset set the default key now that localParams have been removed
  key = statsField;

  // 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
    this.base = searcher.getDocSet(qlist);
  }

}
 
开发者ID:europeana,项目名称:search,代码行数:60,代码来源:StatsComponent.java


注:本文中的org.apache.solr.search.QueryParsing.getLocalParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。