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


Java ModifiableSolrParams.remove方法代码示例

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


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

示例1: getParams

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
@Override
public SolrParams getParams() {
  ModifiableSolrParams params = new ModifiableSolrParams(super.getParams());
  if (shardName == null || shardName.isEmpty()) {
    params.remove("shard");
    if (routeKey == null) {
      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Either shard or routeKey must be provided");
    }
    params.add(ShardParams._ROUTE_, routeKey);
  }
  if (node != null) {
    params.add("node", node);
  }
  if (instanceDir != null)  {
    params.add("instanceDir", instanceDir);
  }
  if (dataDir != null)  {
    params.add("dataDir", dataDir);
  }
  return params;
}
 
开发者ID:europeana,项目名称:search,代码行数:22,代码来源:CollectionAdminRequest.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: getCommonParams

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
public ModifiableSolrParams getCommonParams() {
  ModifiableSolrParams params = (ModifiableSolrParams) super.getParams();
  params.remove( "name" );
  params.set( "collection", collection );
  params.set( "shard", shardName);
  params.set( "async", asyncId);
  return params;
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:CollectionAdminRequest.java

示例4: query

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
/**
 * Returns the QueryResponse from {@link #queryServer}  
 */
protected QueryResponse query(boolean setDistribParams, SolrParams p) throws Exception {
  
  final ModifiableSolrParams params = new ModifiableSolrParams(p);

  // TODO: look into why passing true causes fails
  params.set("distrib", "false");
  final QueryResponse controlRsp = controlClient.query(params);
  validateControlData(controlRsp);

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

  QueryResponse rsp = queryServer(params);

  compareResponses(rsp, controlRsp);

  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(clients.size());
            SolrServer client = clients.get(which);
            try {
              QueryResponse rsp = client.query(new ModifiableSolrParams(params));
              if (verifyStress) {
                compareResponses(rsp, controlRsp);
              }
            } catch (SolrServerException e) {
              throw new RuntimeException(e);
            }
          }
        }
      };
      threads[i].start();
    }

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

示例5: submit

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
@Override
public void submit(final ShardRequest sreq, final String shard, final ModifiableSolrParams params) {
  // do this outside of the callable for thread safety reasons
  final List<String> urls = getURLs(shard);

  Callable<ShardResponse> task = new Callable<ShardResponse>() {
    @Override
    public ShardResponse call() throws Exception {

      ShardResponse srsp = new ShardResponse();
      if (sreq.nodeName != null) {
        srsp.setNodeName(sreq.nodeName);
      }
      srsp.setShardRequest(sreq);
      srsp.setShard(shard);
      SimpleSolrResponse ssr = new SimpleSolrResponse();
      srsp.setSolrResponse(ssr);
      long startTime = System.nanoTime();

      try {
        params.remove(CommonParams.WT); // use default (currently javabin)
        params.remove(CommonParams.VERSION);

        // SolrRequest req = new QueryRequest(SolrRequest.METHOD.POST, "/select");
        // use generic request to avoid extra processing of queries
        QueryRequest req = new QueryRequest(params);
        req.setMethod(SolrRequest.METHOD.POST);

        // no need to set the response parser as binary is the default
        // req.setResponseParser(new BinaryResponseParser());

        // if there are no shards available for a slice, urls.size()==0
        if (urls.size()==0) {
          // TODO: what's the right error code here? We should use the same thing when
          // all of the servers for a shard are down.
          throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, "no servers hosting shard: " + shard);
        }

        if (urls.size() <= 1) {
          String url = urls.get(0);
          srsp.setShardAddress(url);
          SolrServer server = new HttpSolrServer(url, httpClient);
          try {
            ssr.nl = server.request(req);
          } finally {
            server.shutdown();
          }
        } else {
          LBHttpSolrServer.Rsp rsp = httpShardHandlerFactory.makeLoadBalancedRequest(req, urls);
          ssr.nl = rsp.getResponse();
          srsp.setShardAddress(rsp.getServer());
        }
      }
      catch( ConnectException cex ) {
        srsp.setException(cex); //????
      } catch (Exception th) {
        srsp.setException(th);
        if (th instanceof SolrException) {
          srsp.setResponseCode(((SolrException)th).code());
        } else {
          srsp.setResponseCode(-1);
        }
      }

      ssr.elapsedTime = TimeUnit.MILLISECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);

      return srsp;
    }
  };

  pending.add( completionService.submit(task) );
}
 
开发者ID:europeana,项目名称:search,代码行数:73,代码来源:HttpShardHandler.java

示例6: doEmptyFacetCounts

import org.apache.solr.common.params.ModifiableSolrParams; //导入方法依赖的package包/类
static void doEmptyFacetCounts(String field, String[] prefixes) throws Exception {
  SchemaField sf = h.getCore().getLatestSchema().getField(field);

  String response = JQ(req("q", "*:*"));
  Map rsp = (Map) ObjectBuilder.fromJSON(response);
  Long numFound  = (Long)(((Map)rsp.get("response")).get("numFound"));

  ModifiableSolrParams params = params("q","*:*", "rows","0", "facet","true", "facet.field","{!key=myalias}"+field);
  
  String[] methods = {null, "fc","enum","fcs"};
  if (sf.multiValued() || sf.getType().multiValuedFieldCache()) {
    methods = new String[]{null, "fc","enum"};
  }

  prefixes = prefixes==null ? new String[]{null} : prefixes;


  for (String method : methods) {
    if (method == null) {
      params.remove("facet.method");
    } else {
      params.set("facet.method", method);
    }
    for (String prefix : prefixes) {
      if (prefix == null) {
        params.remove("facet.prefix");
      } else {
        params.set("facet.prefix", prefix);
      }

      for (String missing : new String[] {null, "true"}) {
        if (missing == null) {
          params.remove("facet.missing");
        } else {
          params.set("facet.missing", missing);
        }
        
        String expected = missing==null ? "[]" : "[null," + numFound + "]";
        
        assertJQ(req(params),
            "/facet_counts/facet_fields/myalias==" + expected);
      }
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:46,代码来源:SimpleFacetsTest.java

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