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


Java ModifiableSolrParams.get方法代码示例

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


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

示例1: prepareGroupQueryParams

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
@Override
public void prepareGroupQueryParams(ModifiableSolrParams params) {

  String pt = params.get(SpatialParams.POINT);
  if (pt == null) {
    return;
  }

  params.add(SpatialParams.POINT, pt);
  params.add(CommonParams.FQ, fq);
  params.add(SpatialParams.FIELD, sfield);

  // Use distance from config if not available in the request
  String d = params.get(SpatialParams.DISTANCE);
  if (d == null) {
    params.add(SpatialParams.DISTANCE, distance);
  }
}
 
开发者ID:sematext,项目名称:solr-autocomplete,代码行数:19,代码来源:LocationGroupingHandler.java

示例2: redirectToQueryHandler

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
/**
 * redirects to query handler by using value of 'qt' parameter
 */
private static void redirectToQueryHandler(HttpServletRequest request, HttpServletResponse resp)
    throws IOException {
    ModifiableSolrParams solrQueryParameter = getSolrQueryParameter(request);
    String queryHandlerPath = solrQueryParameter.get(QUERY_HANDLER_PAR_NAME, QUERY_PATH);
    solrQueryParameter.remove(QUERY_HANDLER_PAR_NAME);
    Map<String, String[]> parameters = toMultiMap(solrQueryParameter);
    doRedirectToQueryHandler(resp, queryHandlerPath, parameters);
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:12,代码来源:MCRSolrProxyServlet.java

示例3: executeAndSerialize

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
public void executeAndSerialize(FulltextQuery query,
    OutputStream outputStream) throws FullTextSearchException {
statsUsageService.increaseUsage(StatsUsageType.FULLTEXT);
Assert.notNull(query, "Can not execute a null query");
Assert.notNull(outputStream,
	"Can not serialize into a null outputStream");
String queryString = ZipcodeNormalizer.normalize(query.getQuery(), query.getCountryCode());
query.withQuery(queryString);
try {
	if (!disableLogging){
		logger.info(query.toString());
	}

    ModifiableSolrParams params = FulltextQuerySolrHelper.parameterize(query);
    CommonsHttpSolrServer server = new CommonsHttpSolrServer(solrClient
	    .getURL(), this.httpClient,
	    new OutputstreamResponseWrapper(outputStream, params
		    .get(Constants.OUTPUT_FORMAT_PARAMETER)));
    server.query(params);
} catch (SolrServerException e) {
    logger.error("Can not execute query " + FulltextQuerySolrHelper.toQueryString(query)
	    + "for URL : " + solrClient.getURL() + " : "
	    + e.getCause().getMessage(),e);
    throw new FullTextSearchException(e.getCause().getMessage());
} catch (MalformedURLException e1) {
    logger.error("The URL " + solrClient.getURL() + " is incorrect",e1);
    throw new FullTextSearchException(e1);
} catch (RuntimeException e2) {
    String message = e2.getCause()!=null?e2.getCause().getMessage():e2.getMessage();
    logger
	    .error("An error has occurred during fulltext search of query "
		    + query + " : " + message,e2);
    throw new FullTextSearchException(message,e2);
}

   }
 
开发者ID:gisgraphy,项目名称:gisgraphy,代码行数:37,代码来源:FullTextSearchEngine.java

示例4: deleteSnapshot

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
private void deleteSnapshot(ModifiableSolrParams params, SolrQueryResponse rsp, SolrQueryRequest req) {
  String name = params.get("name");
  if(name == null) {
    throw new SolrException(ErrorCode.BAD_REQUEST, "Missing mandatory param: name");
  }

  SnapShooter snapShooter = new SnapShooter(core, params.get("location"), params.get("name"));
  snapShooter.validateDeleteSnapshot();
  snapShooter.deleteSnapAsync(this);
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:ReplicationHandler.java

示例5: 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

示例6: queryPartialResults

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
protected void queryPartialResults(final List<String> upShards,
                                   final List<SolrServer> upClients, 
                                   Object... q) throws Exception {
  
  final ModifiableSolrParams params = new ModifiableSolrParams();

  for (int i = 0; i < q.length; i += 2) {
    params.add(q[i].toString(), q[i + 1].toString());
  }
  // TODO: look into why passing true causes fails
  params.set("distrib", "false");
  final QueryResponse controlRsp = controlClient.query(params);
  // if time.allowed is specified then even a control response can return a partialResults header
  if (params.get(CommonParams.TIME_ALLOWED) == null)  {
    validateControlData(controlRsp);
  }

  params.remove("distrib");
  setDistributedParams(params);

  QueryResponse rsp = queryRandomUpServer(params,upClients);

  comparePartialResponses(rsp, controlRsp, upShards);

  if (stress > 0) {
    log.info("starting stress...");
    Thread[] threads = new Thread[nThreads];
    for (int i = 0; i < threads.length; i++) {
      threads[i] = new Thread() {
        @Override
        public void run() {
          for (int j = 0; j < stress; j++) {
            int which = r.nextInt(upClients.size());
            SolrServer client = upClients.get(which);
            try {
              QueryResponse rsp = client.query(new ModifiableSolrParams(params));
              if (verifyStress) {
                comparePartialResponses(rsp, controlRsp, upShards);
              }
            } catch (SolrServerException e) {
              throw new RuntimeException(e);
            }
          }
        }
      };
      threads[i].start();
    }

    for (Thread thread : threads) {
      thread.join();
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:54,代码来源:TestDistributedSearch.java


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