Java Code Examples for org.apache.solr.client.solrj.SolrQuery#setRows()

The following examples show how to use org.apache.solr.client.solrj.SolrQuery#setRows() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MCRRestAPIClassifications.java    From mycore with GNU General Public License v3.0 6 votes vote down vote up
private void filterNonEmpty(String classId, Element e) {
    SolrClient solrClient = MCRSolrClientFactory.getMainSolrClient();
    Element[] categories = e.getChildren("category").toArray(Element[]::new);
    for (Element cat : categories) {
        SolrQuery solrQquery = new SolrQuery();
        solrQquery.setQuery(
            "category:\"" + MCRSolrUtils.escapeSearchValue(classId + ":" + cat.getAttributeValue("ID")) + "\"");
        solrQquery.setRows(0);
        try {
            QueryResponse response = solrClient.query(solrQquery);
            SolrDocumentList solrResults = response.getResults();
            if (solrResults.getNumFound() == 0) {
                cat.detach();
            } else {
                filterNonEmpty(classId, cat);
            }
        } catch (SolrServerException | IOException exc) {
            LOGGER.error(exc);
        }

    }
}
 
Example 2
Source File: PerformanceTest.java    From solr-spatial-clustering with Apache License 2.0 6 votes vote down vote up
@Test
public void performance() throws IOException, SolrServerException {
    SolrQuery query = new SolrQuery("*:*");
    query.setRows(0);
    query.set("spatial-clustering", true);

    long totalTime = 0;
    for (int i = 5; i <= 100; i += 5) {
        query.set("spatial-clustering.size", i);

        QueryResponse response = infrastructureRule.getSolrClient().query(query);
        LOGGER.info("Results: {}, Clusters: {}, QTime: {}", response.getResults().getNumFound(), i, response.getQTime());

        totalTime += response.getQTime();
    }

    LOGGER.info("Total time: {} ms", totalTime);
}
 
Example 3
Source File: MCRSwordSolrObjectIDSupplier.java    From mycore with GNU General Public License v3.0 6 votes vote down vote up
@Override
public List<MCRObjectID> get(int from, int count) throws SwordServerException {
    final SolrQuery queryCopy = this.solrQuery.getCopy();
    queryCopy.setStart(from);
    queryCopy.setRows(count);
    try {
        final QueryResponse queryResponse = MCRSolrClientFactory.getMainSolrClient().query(queryCopy);
        return queryResponse.getResults().stream()
            .map(r -> (String) r.getFieldValue("id"))
            .map(MCRObjectID::getInstance)
            .collect(Collectors.toList());
    } catch (SolrServerException | IOException e) {
        throw new SwordServerException("Error while getting id list with MCRSword2SolrObjectIDSupplier and Query: "
            + this.solrQuery, e);
    }
}
 
Example 4
Source File: ClusteringTest.java    From solr-spatial-clustering with Apache License 2.0 6 votes vote down vote up
@Test
public void belowMinSize() throws Exception {
    SolrQuery query = new SolrQuery("*:*");
    query.setRows(ROWS);
    query.set(PARAMETER_SPATIALCLUSTERING, true);
    query.set(PARAMETER_SIZE, 0);

    try {
        infrastructureRule.getSolrClient().query(query);
    } catch (SolrServerException e) {
        Throwable rootCause = e.getRootCause();

        assertTrue(rootCause instanceof IllegalArgumentException);
        assertEquals("The requested size must be at least 1.", rootCause.getMessage());
    }
}
 
Example 5
Source File: TestDynamicFieldNamesIndexCorrectly.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
void populateIndex(int numRuns) throws IOException, SolrServerException {
  try {
    for (int i = 0; i < numRuns; i++) {
      log.debug("Iteration number: {}", i);
      cloudClient.deleteByQuery(COLLECTION, "*:*");
      cloudClient.commit(COLLECTION);

      final Collection<SolrInputDocument> solrDocs = generateRandomizedFieldDocuments();
      addToSolr(solrDocs);

      final SolrQuery solrQuery = new SolrQuery("*:*");
      solrQuery.setRows(solrDocs.size());
      final SolrDocumentList resultDocs = getSolrResponse(solrQuery, COLLECTION);
      log.debug("{}", resultDocs);
      assertThatDocsHaveCorrectFields(solrDocs, resultDocs);
    }
  } finally {
    cloudClient.close();
  }
}
 
Example 6
Source File: SolrDocumentSearch.java    From BioSolr with Apache License 2.0 6 votes vote down vote up
@Override
public ResultsList<Document> searchByEfoUri(int start, int rows, String term, String... uris) throws SearchEngineException {
	ResultsList<Document> results = null;

	try {
		SolrQuery query = new SolrQuery(term + " OR " + EFO_URI_FIELD + ":" + buildUriFilter(uris));
		// query.addFilterQuery(EFO_URI_FIELD + ":" + buildUriFilter(uris));
		query.setStart(start);
		query.setRows(rows);
		query.setRequestHandler(config.getDocumentUriRequestHandler());

		LOGGER.debug("Solr query: {}", query);

		QueryResponse response = server.query(query);
		List<Document> docs = response.getBeans(Document.class);
		results = new ResultsList<>(docs, start, (start / rows), response.getResults().getNumFound());
	} catch (SolrServerException e) {
		throw new SearchEngineException(e);
	}

	return results;
}
 
Example 7
Source File: ItemSearchServiceLiveTest.java    From tutorials with MIT License 6 votes vote down vote up
@Test
public void whenSearchingByBasicQuery_thenAllMatchingItemsShouldAvialble() throws Exception {
    itemSearchService.index("hm0001", "Brand1 Washing Machine", "Home Appliances", 450f);
    itemSearchService.index("hm0002", "Brand1 Refrigerator", "Home Appliances", 450f);
    itemSearchService.index("hm0003", "LED TV 32", "Brand1 Home Appliances", 450f);

    SolrQuery query = new SolrQuery();
    query.setQuery("brand1");
    query.setStart(0);
    query.setRows(10);

    QueryResponse response = solrClient.query(query);
    List<Item> items = response.getBeans(Item.class);

    assertEquals(3, items.size());

}
 
Example 8
Source File: ServiceLogsManager.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
public ServiceComponentMetadataWrapper getComponentMetadata(String clusters) {
  String pivotFields = COMPONENT + ",group";
  SolrQuery solrQuery = new SolrQuery();
  solrQuery.setQuery("*:*");
  solrQuery.setRows(0);
  solrQuery.set("facet", true);
  solrQuery.set("facet.pivot", pivotFields);
  SolrUtil.addListFilterToSolrQuery(solrQuery, CLUSTER, clusters);
  QueryResponse queryResponse = serviceLogsSolrDao.process(solrQuery, "/serivce/logs/components");
  return responseDataGenerator.generateGroupedComponentMetadataResponse(
    queryResponse, pivotFields, uiMappingConfig.getServiceGroupLabels(), uiMappingConfig.getServiceComponentLabels());
}
 
Example 9
Source File: AuditLogsManager.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
public Map<String, String> getAuditComponents(String clusters) {
  SolrQuery solrQuery = new SolrQuery();
  solrQuery.setQuery("*:*");
  solrQuery.setRows(0);
  SolrUtil.setFacetField(solrQuery, AUDIT_COMPONENT);
  QueryResponse queryResponse = auditSolrDao.process(solrQuery);
  return responseDataGenerator.generateComponentMetadata(queryResponse, AUDIT_COMPONENT,
    uiMappingConfig.getAuditComponentLabels());
}
 
Example 10
Source File: StandardSearchEngine.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Prepares the query for a search.
 */
protected SolrQuery prepareSearchQuery(String expression, String[] filters, String expressionLanguage,
		Integer rows) {
	SolrQuery query = new SolrQuery();
	query.setQuery(expression);
	query.setSort(SortClause.desc("score"));
	if (rows != null)
		query.setRows(rows);
	if (filters != null)
		query.addFilterQuery(filters);

	query.set("exprLang", expressionLanguage);
	return query;
}
 
Example 11
Source File: ServiceLogsManager.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
private Date getDocDateFromNextOrLastPage(ServiceLogRequest request, String keyword, boolean isNext, int currentPageNumber, int maxRows) {
  int lastOrFirstLogIndex;
  if (isNext) {
    lastOrFirstLogIndex = ((currentPageNumber + 1) * maxRows);
  } else {
    if (currentPageNumber == 0) {
      throw new NotFoundException("This is the first Page");
    }
    lastOrFirstLogIndex = (currentPageNumber * maxRows) - 1;
  }
  SimpleQuery sq = conversionService.convert(request, SimpleQuery.class);
  SolrQuery nextPageLogTimeQuery = new DefaultQueryParser().doConstructSolrQuery(sq);
  nextPageLogTimeQuery.remove("start");
  nextPageLogTimeQuery.remove("rows");
  nextPageLogTimeQuery.setStart(lastOrFirstLogIndex);
  nextPageLogTimeQuery.setRows(1);

  QueryResponse queryResponse = serviceLogsSolrDao.process(nextPageLogTimeQuery);
  if (queryResponse == null) {
    throw new MalformedInputException(String.format("Cannot process next page query for \"%s\" ", keyword));
  }
  SolrDocumentList docList = queryResponse.getResults();
  if (docList == null || docList.isEmpty()) {
    throw new MalformedInputException(String.format("Next page element for \"%s\" is not found", keyword));
  }

  SolrDocument solrDoc = docList.get(0);
  return (Date) solrDoc.get(LOGTIME);
}
 
Example 12
Source File: SearchServiceImpl.java    From learning-taotaoMall with MIT License 5 votes vote down vote up
@Override
public SearchResult search(String queryString, int page, int rows) throws Exception {
	//创建查询对象
	SolrQuery query = new SolrQuery();
	//设置查询条件
	query.setQuery(queryString);
	//设置分页
	query.setStart((page - 1) * rows);
	query.setRows(rows);
	//设置默认搜素域
	query.set("df", "item_keywords");
	//设置高亮显示
	query.setHighlight(true);
	query.addHighlightField("item_title");
	query.setHighlightSimplePre("<em style=\"color:red\">");
	query.setHighlightSimplePost("</em>");
	//执行查询
	SearchResult searchResult = searchDao.search(query);
	//计算查询结果总页数
	long recordCount = searchResult.getRecordCount();
	long pageCount = recordCount / rows;
	if (recordCount % rows > 0) {
		pageCount++;
	}
	searchResult.setPageCount(pageCount);
	searchResult.setCurPage(page);

	return searchResult;
}
 
Example 13
Source File: ClusteringTest.java    From solr-spatial-clustering with Apache License 2.0 5 votes vote down vote up
@Test
public void belowMinResultCount() throws Exception {
    SolrQuery query = new SolrQuery("*:*");
    query.setRows(ROWS);
    query.set(PARAMETER_SPATIALCLUSTERING, true);
    query.set(PARAMETER_SIZE, TOTAL_DOC_COUNT);
    query.set(PARAMETER_MIN_RESULT_COUNT, TOTAL_DOC_COUNT + 1);

    QueryResponse response = infrastructureRule.getSolrClient().query(query);
    assertNull(this.getClusteringCompact(response));
}
 
Example 14
Source File: SearchITCase.java    From apache-solr-essentials with Apache License 2.0 5 votes vote down vote up
/**
 * Selects all documents using an handler configured with SolrQueryParser
 * 
 * @throws Exception hopefully never, otherwise the test fails.
 */
@Test
public void selectAll() throws Exception {
	// 1. Prepare the Query object
	// The query string can be directly injected in the constructor
	final SolrQuery query = new SolrQuery("*:*");
	query.setRequestHandler("/h1");
	
	// These settings will override the "defaults" section
	query.setFacet(false);
	query.setHighlight(false);
	query.setSort("released", ORDER.desc);
	
	// We are asking 5 documents per page
	query.setRows(5);
	
	// 2. Send the query request and get the corresponding response.
	final QueryResponse response = SEARCHER.query(query);
	
	// 3. Get the result object, containing documents and metadata.
	final SolrDocumentList documents = response.getResults();
	
	// If not explicitly requested (or set in the handler) the start is set to 0
	assertEquals(0, documents.getStart());
	
	// Total number of documents found must be equals to all documents we previously indexed
	assertEquals(sampleData().size(), documents.getNumFound());
	
	// Page size must be 5, as requested
	assertEquals(5, documents.size());
}
 
Example 15
Source File: SegmentTerminateEarlyTestState.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
void queryTimestampDescendingSegmentTerminateEarlyYesGrouped(CloudSolrClient cloudSolrClient) throws Exception {
  TestSegmentSorting.assertFalse(maxTimestampDocKeys.isEmpty());
  TestSegmentSorting.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
  final Long oddFieldValue = (long) (maxTimestampDocKeys.iterator().next().intValue() % 2);
  final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
  query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
  query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
  query.setRows(1);
  query.set(CommonParams.SEGMENT_TERMINATE_EARLY, true);
  TestSegmentSorting.assertTrue("numDocs="+numDocs+" is not quad-able", (numDocs%4)==0);
  query.add("group.field", QUAD_FIELD);
  query.set("group", true);
  final QueryResponse rsp = cloudSolrClient.query(query);
  // check correctness of the results count
  TestSegmentSorting.assertEquals("matches", numDocs/2, rsp.getGroupResponse().getValues().get(0).getMatches());
  // check correctness of the first result
  if (rsp.getGroupResponse().getValues().get(0).getMatches() > 0) {
    final SolrDocument solrDocument = rsp.getGroupResponse().getValues().get(0).getValues().get(0).getResult().get(0);
    final Integer idAsInt = Integer.parseInt(solrDocument.getFieldValue(KEY_FIELD).toString());
    TestSegmentSorting.assertTrue
      (KEY_FIELD +"="+idAsInt+" of ("+solrDocument+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
       maxTimestampDocKeys.contains(idAsInt));
    TestSegmentSorting.assertEquals(ODD_FIELD, oddFieldValue, solrDocument.getFieldValue(ODD_FIELD));
  }
  // check segmentTerminatedEarly flag
  // at present segmentTerminateEarly cannot be used with grouped queries
  TestSegmentSorting.assertFalse("responseHeader.segmentTerminatedEarly present/true in "+rsp.getResponseHeader(),
      Boolean.TRUE.equals(rsp.getResponseHeader().get(SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY)));
}
 
Example 16
Source File: UsingSolrJRefGuideExamplesTest.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Test
public void queryWithSolrQueryExample() throws Exception {
  final int numResultsToReturn = 3;
  expectLine("Found 3 documents");
  expectLine("id: 1; name: Fitbit Alta");
  expectLine("id: 2; name: Sony Walkman");
  expectLine("id: 3; name: Garmin GPS");
  final SolrClient client = getSolrClient();

  // tag::solrj-query-with-solrquery[]
  final SolrQuery query = new SolrQuery("*:*");
  query.addField("id");
  query.addField("name");
  query.setSort("id", ORDER.asc);
  query.setRows(numResultsToReturn);
  // end::solrj-query-with-solrquery[]

  final QueryResponse response = client.query("techproducts", query);
  final SolrDocumentList documents = response.getResults();

  print("Found " + documents.getNumFound() + " documents");
  assertEquals(numResultsToReturn, documents.size());
  for(SolrDocument document : documents) {
    final String id = (String) document.getFirstValue("id");
    final String name = (String) document.getFirstValue("name");
    
    print("id: "+ id + "; name: " + name);
  }
}
 
Example 17
Source File: SolrDeleteDuplicates.java    From anthelion with Apache License 2.0 4 votes vote down vote up
public RecordReader<Text, SolrRecord> getRecordReader(final InputSplit split,
    final JobConf job, 
    Reporter reporter)
    throws IOException {

  SolrServer solr = SolrUtils.getCommonsHttpSolrServer(job);
  SolrInputSplit solrSplit = (SolrInputSplit) split;
  final int numDocs = solrSplit.getNumDocs();
  
  SolrQuery solrQuery = new SolrQuery(SOLR_GET_ALL_QUERY);
  solrQuery.setFields(SolrConstants.ID_FIELD, SolrConstants.BOOST_FIELD,
                      SolrConstants.TIMESTAMP_FIELD,
                      SolrConstants.DIGEST_FIELD);
  solrQuery.setStart(solrSplit.getDocBegin());
  solrQuery.setRows(numDocs);

  QueryResponse response;
  try {
    response = solr.query(solrQuery);
  } catch (final SolrServerException e) {
    throw new IOException(e);
  }

  final SolrDocumentList solrDocs = response.getResults();

  return new RecordReader<Text, SolrRecord>() {

    private int currentDoc = 0;

    public void close() throws IOException { }

    public Text createKey() {
      return new Text();
    }

    public SolrRecord createValue() {
      return new SolrRecord();
    }

    public long getPos() throws IOException {
      return currentDoc;
    }

    public float getProgress() throws IOException {
      return currentDoc / (float) numDocs;
    }

    public boolean next(Text key, SolrRecord value) throws IOException {
      if (currentDoc >= numDocs) {
        return false;
      }

      SolrDocument doc = solrDocs.get(currentDoc);
      String digest = (String) doc.getFieldValue(SolrConstants.DIGEST_FIELD);
      key.set(digest);
      value.readSolrDocument(doc);

      currentDoc++;
      return true;
    }    
  };
}
 
Example 18
Source File: SolrController.java    From Spring-Boot-Book with Apache License 2.0 4 votes vote down vote up
@RequestMapping("/queryAll")
    public Object queryAll() throws IOException, SolrServerException {


        //第二种方式
        SolrQuery solrQuery = new SolrQuery();
        // 设置默认搜索域
        solrQuery.setQuery("*:*");
//        solrQuery.addField("*");
        solrQuery.set("q", "知然");
        solrQuery.add("q", "name:然");
        // 设置返回结果的排序规则
        solrQuery.setSort("id", SolrQuery.ORDER.asc);
        //设置查询的条数
        solrQuery.setRows(50);
        //设置查询的开始
        solrQuery.setStart(0);
        // 设置分页参数
        solrQuery.setStart(0);
        solrQuery.setRows(20);
        //设置高亮
        solrQuery.setHighlight(true);
        //设置高亮的字段
        solrQuery.addHighlightField("name");
        //设置高亮的样式
        solrQuery.setHighlightSimplePre("<font color='red'>");
        solrQuery.setHighlightSimplePost("</font>");
        System.out.println(solrQuery);
        QueryResponse response = solrClient.query(solrQuery);
        //返回高亮显示结果
        Map<String, Map<String, List<String>>> highlighting = response.getHighlighting();
        //response.getResults();查询返回的结果

        SolrDocumentList documentList = response.getResults();
        long numFound = documentList.getNumFound();
        System.out.println("总共查询到的文档数量: " + numFound);
        for (SolrDocument solrDocument : documentList) {
            System.out.println("solrDocument==============" + solrDocument);
            System.out.println("solrDocument==============" + solrDocument.get("name"));
        }
        return highlighting;
    }
 
Example 19
Source File: SearchITCase.java    From apache-solr-essentials with Apache License 2.0 4 votes vote down vote up
/**
 * Demonstrates how to ask for faceting and iterate over response facets.
 * 
 * @throws Exception hopefully never, otherwise the test fails.
 */
@Test
public void facets() throws Exception {
	// 1. Prepare the Query object
	// The query string can be directly injected in the constructor
	final SolrQuery query = new SolrQuery("*:*");
	query.setRequestHandler("/h1");
	
	// These settings will override the "defaults" section
	// Note that this handler sets facet to true, so the following line is
	// not actually needed
	query.setFacet(true);
	query.addFacetField("genre", "released");
	
	// We don't want highlighting here
	// Since the HL component is disabled by default, also this line is not needed.
	query.setHighlight(false);
	
	// We are only interested in facets, so skip don't include any 
	// document in the response.
	query.setRows(0);
	
	// 2. Send the query request and get the corresponding response.
	final QueryResponse response = SEARCHER.query(query);
	
	// 3. Get the result object, containing documents and metadata.
	final SolrDocumentList documents = response.getResults();
	
	// If not explicitly requested (or set in the handler) the start is set to 0
	assertEquals(0, documents.getStart());
	
	// Total number of documents found must be equals to all documents we previously indexed
	assertEquals(sampleData().size(), documents.getNumFound());
	
	// Page size must be 0, as requested
	assertEquals(0, documents.size());
	
	final FacetField genre = response.getFacetField("genre");
	assertNotNull(genre);
	 
	// This is something that should never appear within a TestCase :) 
	// however is useful to demonstrate how to iterate over facet values
	for (final Count count : genre.getValues()) {
		// e.g. Jazz : 19
		// e.g. Fusion: 11
		System.out.println(count.getName() + " : " + count.getCount());
	}
}
 
Example 20
Source File: SegmentTerminateEarlyTestState.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
void queryTimestampDescendingSegmentTerminateEarlyNo(CloudSolrClient cloudSolrClient) throws Exception {
  TestSegmentSorting.assertFalse(maxTimestampDocKeys.isEmpty());
  TestSegmentSorting.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
  final Long oddFieldValue = (long) (maxTimestampDocKeys.iterator().next().intValue() % 2);
  final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
  query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
  query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
  query.setRows(1);
  final Boolean shardsInfoWanted = (rand.nextBoolean() ? null : rand.nextBoolean());
  if (shardsInfoWanted != null) {
    query.set(ShardParams.SHARDS_INFO, shardsInfoWanted.booleanValue());
  }
  query.set(CommonParams.SEGMENT_TERMINATE_EARLY, false);
  final QueryResponse rsp = cloudSolrClient.query(query);
  // check correctness of the results count
  TestSegmentSorting.assertEquals("numFound", numDocs/2, rsp.getResults().getNumFound());
  // check correctness of the first result
  if (rsp.getResults().getNumFound() > 0) {
    final SolrDocument solrDocument0 = rsp.getResults().get(0);
    final Integer idAsInt = Integer.parseInt(solrDocument0.getFieldValue(KEY_FIELD).toString());
    TestSegmentSorting.assertTrue
      (KEY_FIELD +"="+idAsInt+" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
       maxTimestampDocKeys.contains(idAsInt));
    TestSegmentSorting.assertEquals(ODD_FIELD, oddFieldValue, rsp.getResults().get(0).getFieldValue(ODD_FIELD));
  }
  // check segmentTerminatedEarly flag
  TestSegmentSorting.assertNull("responseHeader.segmentTerminatedEarly present in "+rsp.getResponseHeader(),
      rsp.getResponseHeader().get(SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY));
  TestSegmentSorting.assertFalse("responseHeader.segmentTerminatedEarly present/true in "+rsp.getResponseHeader(),
      Boolean.TRUE.equals(rsp.getResponseHeader().get(SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY)));
  // check shards info
  final Object shardsInfo = rsp.getResponse().get(ShardParams.SHARDS_INFO);
  if (!Boolean.TRUE.equals(shardsInfoWanted)) {
    TestSegmentSorting.assertNull(ShardParams.SHARDS_INFO, shardsInfo);
  } else {
    TestSegmentSorting.assertNotNull(ShardParams.SHARDS_INFO, shardsInfo);
    int segmentTerminatedEarlyShardsCount = 0;
    for (Map.Entry<String, ?> si : (SimpleOrderedMap<?>)shardsInfo) {
      if (Boolean.TRUE.equals(((SimpleOrderedMap)si.getValue()).get(SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY))) {
        segmentTerminatedEarlyShardsCount += 1;
      }
    }
    TestSegmentSorting.assertEquals("shards reporting "+SolrQueryResponse.RESPONSE_HEADER_SEGMENT_TERMINATED_EARLY_KEY,
        0, segmentTerminatedEarlyShardsCount);
  }
}