當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。