• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ShardParams类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ShardParams类属于org.apache.solr.common.params包,在下文中一共展示了ShardParams类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
@Test
@ShardsFixed(num = 2)
public void test() throws Exception {
  handle.clear();
  handle.put("QTime", SKIPVAL);
  handle.put("timestamp", SKIPVAL);
  handle.put("maxScore", SKIPVAL);
  handle.put("responseHeader", SKIP);
  handle.put("spellchecked_response", UNORDERED);

  query(CommonParams.QT, "standardResWithCommonMisspellings", 
      ShardParams.SHARDS_QT, "standardResWithCommonMisspellings",
      CommonParams.Q, "foo:bobo AND foo:marley", 
      SpellingParams.SPELLCHECK_COLLATE, "true",
      SpellingParams.SPELLCHECK_BUILD, "true", 
      SpellingParams.SPELLCHECK_COUNT, "10",
      SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true", 
      DymReSearcher.COMPONENT_NAME, "true",
      SpellCheckComponent.COMPONENT_NAME, "true");
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:21,代码来源:TestDistributedDymReSearcher.java


示例2: process

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
@Override
public void process(ResponseBuilder rb) throws IOException {

  Boolean isFusionQuery = rb.req.getParams().getBool(IS_FUSION_QUERY_PARAM);
  if (isFusionQuery != null) {
    if (isFusionQuery) {
      log.info("Skipping the logging to Fusion as this is a Fusion query");
      return;
    }
  }

  SolrParams params = rb.req.getParams();
  boolean isShard = params.getBool(ShardParams.IS_SHARD, false);
  if (isShard) {
    return;
  }
  
  sendSearchLogsToFusion(rb, false);
}
 
开发者ID:lucidworks,项目名称:fusion-solr-plugins,代码行数:20,代码来源:LogToFusionComponent.java


示例3: finishStage

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
@Override
public void finishStage(ResponseBuilder rb) {


  SolrParams params = rb.req.getParams();

  boolean isShard = params.getBool(ShardParams.IS_SHARD, false);
  if (isShard) {
    return;
  }

  Boolean isFusionQuery = params.getBool(IS_FUSION_QUERY_PARAM);
  if (isFusionQuery != null) {
    if (isFusionQuery) {
      log.info("Skipping the logging to Fusion as this a Fusion query");
      return;
    }
  }

  if (rb.stage != ResponseBuilder.STAGE_GET_FIELDS) {
    return;
  }

  sendSearchLogsToFusion(rb, true);
}
 
开发者ID:lucidworks,项目名称:fusion-solr-plugins,代码行数:26,代码来源:LogToFusionComponent.java


示例4: getParams

import org.apache.solr.common.params.ShardParams; //导入依赖的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


示例5: distributedProcess

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
/** Dispatch shard request in <code>STAGE_EXECUTE_QUERY</code> stage */
@Override
public int distributedProcess(ResponseBuilder rb) {
  SolrParams params = rb.req.getParams();
  LOG.info("SuggestComponent distributedProcess with : " + params);
  if (rb.stage < ResponseBuilder.STAGE_EXECUTE_QUERY) 
    return ResponseBuilder.STAGE_EXECUTE_QUERY;
  if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) {
    ShardRequest sreq = new ShardRequest();
    sreq.purpose = ShardRequest.PURPOSE_GET_TOP_IDS;
    sreq.params = new ModifiableSolrParams(rb.req.getParams());
    sreq.params.remove(ShardParams.SHARDS);
    rb.addRequest(this, sreq);
    return ResponseBuilder.STAGE_GET_FIELDS;
  }

  return ResponseBuilder.STAGE_DONE;
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:SuggestComponent.java


示例6: doTest

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
@Override
public void doTest() throws Exception {
  waitForRecoveriesToFinish(false);
  assertEquals(4, cloudClient.getZkStateReader().getClusterState().getCollection(DEFAULT_COLLECTION).getSlices().size());
  index("id", "a!doc1");  // shard3
  index("id", "b!doc1");  // shard1
  index("id", "c!doc1");  // shard2
  index("id", "e!doc1");  // shard4
  commit();

  doQuery("a!doc1", "q", "*:*", ShardParams._ROUTE_, "a!"); // can go to any random node

  // query shard3 directly with _route_=a! so that we trigger the short circuited request path
  Replica shard3 = cloudClient.getZkStateReader().getClusterState().getLeader(DEFAULT_COLLECTION, "shard3");
  String nodeName = shard3.getNodeName();
  SolrServer shard3Client = getClient(nodeName);
  QueryResponse response = shard3Client.query(new SolrQuery("*:*").add(ShardParams._ROUTE_, "a!").add(ShardParams.SHARDS_INFO, "true"));

  assertEquals("Could not find doc", 1, response.getResults().getNumFound());
  NamedList<?> sinfo = (NamedList<?>) response.getResponse().get(ShardParams.SHARDS_INFO);
  assertNotNull("missing shard info for short circuited request", sinfo);
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:TestShortCircuitedRequests.java


示例7: distributedProcess

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
/** Dispatch shard request in <code>STAGE_EXECUTE_QUERY</code> stage */
@Override
public int distributedProcess(ResponseBuilder rb) {
  SolrParams params = rb.req.getParams();
  LOG.debug("SuggestComponent distributedProcess with : " + params);
  if (rb.stage < ResponseBuilder.STAGE_EXECUTE_QUERY) 
    return ResponseBuilder.STAGE_EXECUTE_QUERY;
  if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) {
    ShardRequest sreq = new ShardRequest();
    sreq.purpose = ShardRequest.PURPOSE_GET_TOP_IDS;
    sreq.params = new ModifiableSolrParams(rb.req.getParams());
    sreq.params.remove(ShardParams.SHARDS);
    rb.addRequest(this, sreq);
    return ResponseBuilder.STAGE_GET_FIELDS;
  }

  return ResponseBuilder.STAGE_DONE;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:19,代码来源:AsyncBuildSuggestComponent.java


示例8: prepare

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
@Override
public void prepare(ResponseBuilder rb) throws IOException {
   checkNotNull(rb, "Pre-condition violated: rb must not be null.");
   SolrParams solrParams = rb.req.getParams();

   // Only run this component if it is active and this is not a subrequest (we want to add the boost terms
   // only on the initial request that Solr receives from the outside).
   if (solrParams.getBool(COMPONENT_NAME, false) && !solrParams.getBool(ShardParams.IS_SHARD, false)) {

      // check preconditions
      String q = solrParams.get(CommonParams.Q);
      String sort = solrParams.get(CommonParams.SORT);

      if (q != null
            && !"*:*".equals(q)
            && (sort == null || (StringUtils.containsIgnoreCase(sort, "score") && StringUtils.containsIgnoreCase(
                  sort, "desc")))) {
         prepareInternal(rb);
      }
   }
}
 
开发者ID:shopping24,项目名称:solr-bmax-queryparser,代码行数:22,代码来源:BmaxBoostTermComponent.java


示例9: getAndPrepShardHandler

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
private ShardHandler getAndPrepShardHandler(SolrQueryRequest req, ResponseBuilder rb, ShardHandlerFactory shardHandlerFactory) {
  ShardHandler shardHandler = null;

  boolean isZkAware = false;
  CoreContainer cc = null;
  if (req.getCore() != null) {
    cc = req.getCore().getCoreContainer();
    isZkAware = cc.isZooKeeperAware();
  } 
  
  rb.isDistrib = req.getParams().getBool("distrib", isZkAware);
  if (!rb.isDistrib) {
    // for back compat, a shards param with URLs like localhost:8983/solr will mean that this
    // search is distributed.
    final String shards = req.getParams().get(ShardParams.SHARDS);
    rb.isDistrib = ((shards != null) && (shards.indexOf('/') > 0));
  }
  
  if (rb.isDistrib) {
    shardHandler = shardHandlerFactory.getShardHandler();
    shardHandler.prepDistributed(rb);
    if (!rb.isDistrib) {
      shardHandler = null; // request is not distributed after all and so the shard handler is not needed
    }
  }

  if(isZkAware) {
    ZkController zkController = cc.getZkController();
    NamedList<Object> headers = rb.rsp.getResponseHeader();
    if(headers != null) {
      headers.add("zkConnected", 
          zkController != null 
        ? !zkController.getZkClient().getConnectionManager().isLikelyExpired() 
        : false);
    }
    
  }

  return shardHandler;
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:41,代码来源:ReSearcherHandler.java


示例10: create

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
@Override
public DocTransformer create(String field, SolrParams params, SolrQueryRequest req) {
  String v = req.getParams().get(ShardParams.SHARD_URL);
  if( v == null ) {
    if( req.getParams().getBool(ShardParams.IS_SHARD, false) ) {
      v = "[unknown]";
    }
    else {
      v = "[not a shard request]";
    }
  }
  return new ValueAugmenter( field, v );
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:ShardAugmenterFactory.java


示例11: handleAddReplica

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
private void handleAddReplica(SolrQueryRequest req, SolrQueryResponse rsp) throws KeeperException, InterruptedException  {
  log.info("Add replica action invoked: " + req.getParamString());
  Map<String,Object> props = new HashMap<>();
  props.put(Overseer.QUEUE_OPERATION, CollectionAction.ADDREPLICA.toString());
  copyIfNotNull(req.getParams(), props, COLLECTION_PROP, "node", SHARD_ID_PROP, ShardParams._ROUTE_,
      CoreAdminParams.NAME, CoreAdminParams.INSTANCE_DIR, CoreAdminParams.DATA_DIR, ASYNC);
  ZkNodeProps m = new ZkNodeProps(props);
  handleResponse(CollectionAction.ADDREPLICA.toString(), m, rsp);
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:CollectionsHandler.java


示例12: handleResponses

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
@Override
public void handleResponses(ResponseBuilder rb, ShardRequest sreq) {
  if (!rb.doStats || (sreq.purpose & ShardRequest.PURPOSE_GET_STATS) == 0) return;

  StatsInfo si = rb._statsInfo;

  for (ShardResponse srsp : sreq.responses) {
    NamedList stats = null;
    try {
      stats = (NamedList) srsp.getSolrResponse().getResponse().get("stats");
    } catch (Exception e) {
      if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false)) {
        continue; // looks like a shard did not return anything
      }
      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
          "Unable to read stats info for shard: " + srsp.getShard(), e);
    }

    NamedList stats_fields = (NamedList) stats.get("stats_fields");
    if (stats_fields != null) {
      for (int i = 0; i < stats_fields.size(); i++) {
        String field = stats_fields.getName(i);
        StatsValues stv = si.statsFields.get(field);
        NamedList shardStv = (NamedList) stats_fields.get(field);
        stv.accumulate(shardStv);
      }
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:30,代码来源:StatsComponent.java


示例13: getStatsFields

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
public NamedList<Object> getStatsFields() throws IOException, SyntaxError {
  NamedList<Object> res = new SimpleOrderedMap<>();
  String[] statsFs = params.getParams(StatsParams.STATS_FIELD);
  boolean isShard = params.getBool(ShardParams.IS_SHARD, false);
  if (null != statsFs) {
    final IndexSchema schema = searcher.getSchema();
    for (String f : statsFs) {
      boolean calcDistinct = params.getFieldBool(f, StatsParams.STATS_CALC_DISTINCT, false);

      parseParams(f);

      String[] facets = params.getFieldParams(key, StatsParams.STATS_FACET);
      if (facets == null) {
        facets = new String[0]; // make sure it is something...
      }
      SchemaField sf = schema.getField(statsField);
      FieldType ft = sf.getType();
      NamedList<?> stv;
      
      if (sf.multiValued() || ft.multiValuedFieldCache()) {
        if(sf.hasDocValues()) {
          stv = DocValuesStats.getCounts(searcher, sf.getName(), base, calcDistinct, facets).getStatsValues();
        } else {
          //use UnInvertedField for multivalued fields
          UnInvertedField uif = UnInvertedField.getUnInvertedField(statsField, searcher);
          stv = uif.getStats(searcher, base, calcDistinct, facets).getStatsValues();
        }
      } else {
        stv = getFieldCacheStats(statsField, calcDistinct, facets);
      }
      if (isShard == true || (Long) stv.get("count") > 0) {
        res.add(key, stv);
      } else {
        res.add(key, null);
      }
    }
  }
  return res;
}
 
开发者ID:europeana,项目名称:search,代码行数:40,代码来源:StatsComponent.java


示例14: buildShardQuery

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
ShardRequest buildShardQuery(ResponseBuilder rb, String q, String key) {
  ShardRequest s = new ShardRequest();
  s.params = new ModifiableSolrParams(rb.req.getParams());
  s.purpose |= ShardRequest.PURPOSE_GET_MLT_RESULTS;
  // Maybe unnecessary, but safe.
  s.purpose |= ShardRequest.PURPOSE_PRIVATE;
  
  s.params.remove(ShardParams.SHARDS);
  // s.params.remove(MoreLikeThisComponent.COMPONENT_NAME);
  
  // needed to correlate results
  s.params.set(MoreLikeThisComponent.DIST_DOC_ID, key);
  s.params.set(CommonParams.START, 0);
  int mltcount = s.params.getInt(MoreLikeThisParams.DOC_COUNT, 20); // overrequest
  s.params.set(CommonParams.ROWS, mltcount);
  
  // adding score to rank moreLikeThis
  s.params.remove(CommonParams.FL);
  
  // Should probably add something like this:
  // String fl = s.params.get(MoreLikeThisParams.RETURN_FL, "*");
  // if(fl != null){
  // s.params.set(CommonParams.FL, fl + ",score");
  // }
  String id = rb.req.getSchema().getUniqueKeyField()
  .getName();
  s.params.set(CommonParams.FL, "score," + id);
  s.params.set("sort", "score desc");
  // MLT Query is submitted as normal query to shards.
  s.params.set(CommonParams.Q, q);
  
  return s;
}
 
开发者ID:europeana,项目名称:search,代码行数:34,代码来源:MoreLikeThisComponent.java


示例15: comparePartialResponses

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
protected void comparePartialResponses(QueryResponse rsp, QueryResponse controlRsp, List<String> upShards)
{
  NamedList<?> sinfo = (NamedList<?>) rsp.getResponse().get(ShardParams.SHARDS_INFO);
  
  assertNotNull("missing shard info", sinfo);
  assertEquals("should have an entry for each shard ["+sinfo+"] "+shards, shardsArr.length, sinfo.size());
  // identify each one
  for (Map.Entry<String,?> entry : sinfo) {
    String shard = entry.getKey();
    NamedList<?> info = (NamedList<?>) entry.getValue();
    boolean found = false;
    for(int i=0; i<shardsArr.length; i++) {
      String s = shardsArr[i];
      if (shard.contains(s)) {
        found = true;
        // make sure that it responded if it's up
        if (upShards.contains(s)) {
          assertTrue("Expected to find numFound in the up shard info",info.get("numFound") != null);
          assertTrue("Expected to find shardAddress in the up shard info",info.get("shardAddress") != null);
        }
        else {
          assertEquals("Expected to find the partialResults header set if a shard is down", Boolean.TRUE, rsp.getHeader().get("partialResults"));
          assertTrue("Expected to find error in the down shard info",info.get("error") != null);
        }
      }
    }
    assertTrue("Couldn't find shard " + shard + " represented in shards info", found);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:30,代码来源:TestDistributedSearch.java


示例16: testTolerantSearch

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
public void testTolerantSearch() throws SolrServerException {
  String badShard = "[ff01::0083]:3334";
  SolrQuery query = new SolrQuery();
  query.setQuery("*:*");
  query.set("debug",  "true");
  query.set("distrib", "true");
  query.setFields("id", "text");
  query.set("shards", shard1 + "," + shard2 + "," + badShard);
  try {
    ignoreException("Server refused connection");
    // verify that the request would fail if shards.tolerant=false
    collection1.query(query);
    fail("Expecting exception");
  } catch (SolrException e) {
    //expected
  }
  query.set(ShardParams.SHARDS_TOLERANT, "true");
  QueryResponse response = collection1.query(query);
  assertTrue((Boolean)response.getResponseHeader().get("partialResults"));
  @SuppressWarnings("unchecked")
  NamedList<String> badShardTrack = (NamedList<String>) ((NamedList<NamedList<String>>)
      ((NamedList<NamedList<NamedList<String>>>)response.getDebugMap().get("track")).get("EXECUTE_QUERY")).get(badShard);
  assertEquals("Unexpected response size for shard", 1, badShardTrack.size());
  Entry<String, String> exception = badShardTrack.iterator().next();
  assertEquals("Expected key 'Exception' not found", "Exception", exception.getKey());
  assertNotNull("Exception message should not be null", exception.getValue());
  unIgnoreException("Server refused connection");
}
 
开发者ID:europeana,项目名称:search,代码行数:29,代码来源:DistributedDebugComponentTest.java


示例17: clusterStatusWithRouteKey

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
private void clusterStatusWithRouteKey() throws IOException, SolrServerException {
  CloudSolrServer client = createCloudClient(DEFAULT_COLLECTION);
  try {
    SolrInputDocument doc = new SolrInputDocument();
    doc.addField("id", "a!123"); // goes to shard2. see ShardRoutingTest for details
    client.add(doc);
    client.commit();

    ModifiableSolrParams params = new ModifiableSolrParams();
    params.set("action", CollectionParams.CollectionAction.CLUSTERSTATUS.toString());
    params.set("collection", DEFAULT_COLLECTION);
    params.set(ShardParams._ROUTE_, "a!");
    SolrRequest request = new QueryRequest(params);
    request.setPath("/admin/collections");

    NamedList<Object> rsp = client.request(request);
    NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster");
    assertNotNull("Cluster state should not be null", cluster);
    NamedList<Object> collections = (NamedList<Object>) cluster.get("collections");
    assertNotNull("Collections should not be null in cluster state", collections);
    assertNotNull(collections.get(DEFAULT_COLLECTION));
    assertEquals(1, collections.size());
    Map<String, Object> collection = (Map<String, Object>) collections.get(DEFAULT_COLLECTION);
    Map<String, Object> shardStatus = (Map<String, Object>) collection.get("shards");
    assertEquals(1, shardStatus.size());
    Map<String, Object> selectedShardStatus = (Map<String, Object>) shardStatus.get(SHARD2);
    assertNotNull(selectedShardStatus);
  } finally {
    //remove collections
    client.shutdown();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:33,代码来源:TestCollectionAPI.java


示例18: addCollationsToResponse

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void addCollationsToResponse(SolrParams params, SpellingResult spellingResult, ResponseBuilder rb, String q,
    NamedList response, boolean suggestionsMayOverlap) {
  int maxCollations = params.getInt(SPELLCHECK_MAX_COLLATIONS, 1);
  int maxCollationTries = params.getInt(SPELLCHECK_MAX_COLLATION_TRIES, 0);
  int maxCollationEvaluations = params.getInt(SPELLCHECK_MAX_COLLATION_EVALUATIONS, 10000);
  boolean collationExtendedResults = params.getBool(SPELLCHECK_COLLATE_EXTENDED_RESULTS, false);
  boolean shard = params.getBool(ShardParams.IS_SHARD, false);

  SpellCheckCollator collator = new SpellCheckCollator();
  List<SpellCheckCollation> collations = collator.collate(spellingResult, q, rb, maxCollations, maxCollationTries, maxCollationEvaluations, suggestionsMayOverlap);
  //by sorting here we guarantee a non-distributed request returns all 
  //results in the same order as a distributed request would,
  //even in cases when the internal rank is the same.
  Collections.sort(collations);

  for (SpellCheckCollation collation : collations) {
    if (collationExtendedResults) {
      NamedList extendedResult = new NamedList();
      extendedResult.add("collationQuery", collation.getCollationQuery());
      extendedResult.add("hits", collation.getHits());
      extendedResult.add("misspellingsAndCorrections", collation.getMisspellingsAndCorrections());
      if(maxCollationTries>0 && shard)
      {
        extendedResult.add("collationInternalRank", collation.getInternalRank());
      }
      response.add("collation", extendedResult);
    } else {
      response.add("collation", collation.getCollationQuery());
      if(maxCollationTries>0 && shard)
      {
        response.add("collationInternalRank", collation.getInternalRank());
      }
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:37,代码来源:SpellCheckComponent.java


示例19: getStatsFields

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
public NamedList<Object> getStatsFields() throws IOException {
  NamedList<Object> res = new SimpleOrderedMap<Object>();
  String[] statsFs = params.getParams(StatsParams.STATS_FIELD);
  boolean isShard = params.getBool(ShardParams.IS_SHARD, false);
  if (null != statsFs) {
    for (String f : statsFs) {
      String[] facets = params.getFieldParams(f, StatsParams.STATS_FACET);
      if (facets == null) {
        facets = new String[0]; // make sure it is something...
      }
      SchemaField sf = searcher.getSchema().getField(f);
      FieldType ft = sf.getType();
      NamedList<?> stv;

      if (sf.multiValued() || ft.multiValuedFieldCache()) {
        //use UnInvertedField for multivalued fields
        UnInvertedField uif = UnInvertedField.getUnInvertedField(f, searcher);
        stv = uif.getStats(searcher, docs, facets).getStatsValues();
      } else {
        stv = getFieldCacheStats(f, facets);
      }
      if (isShard == true || (Long) stv.get("count") > 0) {
        res.add(f, stv);
      } else {
        res.add(f, null);
      }
    }
  }
  return res;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:31,代码来源:StatsComponent.java


示例20: comparePartialResponses

import org.apache.solr.common.params.ShardParams; //导入依赖的package包/类
protected void comparePartialResponses(QueryResponse rsp, QueryResponse controlRsp, List<String> upShards)
{
  NamedList<?> sinfo = (NamedList<?>) rsp.getResponse().get(ShardParams.SHARDS_INFO);
  
  assertNotNull("missing shard info", sinfo);
  assertEquals("should have an entry for each shard ["+sinfo+"] "+shards, shardsArr.length, sinfo.size());
  // identify each one
  for (Map.Entry<String,?> entry : sinfo) {
    String shard = entry.getKey();
    NamedList<?> info = (NamedList<?>) entry.getValue();
    boolean found = false;
    for(int i=0; i<shardsArr.length; i++) {
      String s = shardsArr[i];
      if (shard.contains(s)) {
        found = true;
        // make sure that it responded if it's up
        if (upShards.contains(s)) {
          assertTrue("Expected to find numFound in the up shard info",info.get("numFound") != null);
        }
        else {
          assertTrue("Expected to find error in the down shard info",info.get("error") != null);
        }
      }
    }
    assertTrue("Couldn't find shard " + shard + " represented in shards info", found);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:28,代码来源:TestDistributedSearch.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CLibrary类代码示例发布时间:2022-05-22
下一篇:
Java JpaRepositoriesAutoConfiguration类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap