本文整理汇总了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);
}
}
示例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);
}