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


Java ModifiableSolrParams.getParams方法代码示例

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


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

示例1: process

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
/**
 * Actually run the query
 */
@Override
public void process(ResponseBuilder rb) throws IOException {

  //SolrParams params = rb.req.getParams();
  if (rb.doFacets) {
    ModifiableSolrParams params = new ModifiableSolrParams();
    SolrParams origParams = rb.req.getParams();
    Iterator<String> iter = origParams.getParameterNamesIterator();
    while (iter.hasNext()) {
      String paramName = iter.next();
      // Deduplicate the list with LinkedHashSet, but _only_ for facet params.
      if (paramName.startsWith(FacetParams.FACET) == false) {
        params.add(paramName, origParams.getParams(paramName));
        continue;
      }
      HashSet<String> deDupe = new LinkedHashSet<>(Arrays.asList(origParams.getParams(paramName)));
      params.add(paramName, deDupe.toArray(new String[deDupe.size()]));
    }

    SimpleFacets f = new SimpleFacets(rb.req, rb.getResults().docSet, params, rb);
    
    NamedList<Object> counts = f.getFacetCounts();
    String[] pivots = params.getParams(FacetParams.FACET_PIVOT);
    if (pivots != null && pivots.length > 0) {
      PivotFacetProcessor pivotProcessor 
        = new PivotFacetProcessor(rb.req, rb.getResults().docSet, params, rb);
      SimpleOrderedMap<List<NamedList<Object>>> v 
        = pivotProcessor.process(pivots);
      if (v != null) {
        counts.add(PIVOT_KEY, v);
      }
    }
    
    rb.rsp.add("facet_counts", counts);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:40,代码来源:FacetComponent.java

示例2: handleRequestBody

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
@Override
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
    LOGGER.debug("Handling request {}", req);
    final ModifiableSolrParams modifiableSolrParams = new ModifiableSolrParams(req.getParams());

    final String originQuery = modifiableSolrParams.get(CommonParams.Q);

    final long[] startAndEnd = dateRangeParser.getNumericQueryTerms(originQuery);
    final long queryStart = or(startAndEnd[0], -1L, 0L);
    final long queryEnd = or(startAndEnd[1], -1L, Long.MAX_VALUE);

    modifiableSolrParams.set(ChronixQueryParams.QUERY_START_LONG, String.valueOf(queryStart));
    modifiableSolrParams.set(ChronixQueryParams.QUERY_END_LONG, String.valueOf(queryEnd));
    final String query = dateRangeParser.replaceRangeQueryTerms(originQuery);
    modifiableSolrParams.set(CommonParams.Q, query);

    //Set the min required fields if the user define a sub set of fields
    final String fields = modifiableSolrParams.get(CommonParams.FL);
    modifiableSolrParams.set(CommonParams.FL, requestedFields(fields, req.getSchema().getFields().keySet()));
    //Set the updated query
    req.setParams(modifiableSolrParams);

    //check the filter queries
    final String[] chronixFunctions = modifiableSolrParams.getParams(ChronixQueryParams.CHRONIX_FUNCTION);
    final String chronixJoin = modifiableSolrParams.get(ChronixQueryParams.CHRONIX_JOIN);


    //if we have an function query or someone wants the data as json
    if (arrayIsNotEmpty(chronixFunctions) || contains(ChronixQueryParams.DATA_AS_JSON, fields) || !StringUtils.isEmpty(chronixJoin)) {
        LOGGER.debug("Request is an analysis request.");
        analysisHandler.handleRequestBody(req, rsp);
    } else {
        //let the default search handler do its work
        LOGGER.debug("Request is a default request");
        searchHandler.handleRequestBody(req, rsp);
    }

    //add the converted start and end to the response
    rsp.getResponseHeader().add(ChronixQueryParams.QUERY_START_LONG, queryStart);
    rsp.getResponseHeader().add(ChronixQueryParams.QUERY_END_LONG, queryEnd);
}
 
开发者ID:ChronixDB,项目名称:chronix.server,代码行数:43,代码来源:ChronixQueryHandler.java


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