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


Java DocSet.iterator方法代码示例

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


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

示例1: printDocIDs

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private void printDocIDs(DocSet fromSet) throws IOException {
	// Only used in debugging.
	System.out.println("---------------------------");
	DocIterator iter = fromSet.iterator();
	while (iter.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
		Integer docId = iter.next();
		Document d = fromSearcher.doc(docId);
		String id = d.getValues("id")[0];
		// TODO :log message  (this is too verbose?)
		if (debug) {
			System.out.println("INTERNAL ID : " + docId + " DOC : " + id);
		}
	}
	System.out.println("---------------------------");
}
 
开发者ID:kwatters,项目名称:solrgraph,代码行数:17,代码来源:GraphQuery.java

示例2: AbstractSolrCachingScorer

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
AbstractSolrCachingScorer(Weight weight, DocSet in, AtomicReaderContext context, Bits acceptDocs, SolrIndexSearcher searcher)
{
    super(weight);
    this.context = context;
    this.acceptDocs = acceptDocs;
    
    if (in instanceof BitDocSet)
    {
        matches = (BitDocSet) in;
    }
    else
    {
        this.matches = new BitDocSet(new FixedBitSet(searcher.maxDoc()));
        for (DocIterator it = in.iterator(); it.hasNext(); /* */)
        {
            matches.addUnique(it.nextDoc());
        }
    }
    bitSet = matches.getBits();
    
    doc = getBase() - 1;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:AbstractSolrCachingScorer.java

示例3: AbstractSolrCachingScorer

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
AbstractSolrCachingScorer(Similarity similarity, DocSet in, SolrIndexReader solrIndexReader)
{
    super(similarity);
    if (in instanceof BitDocSet)
    {
        matches = (BitDocSet) in;
    }
    else
    {
        this.matches = new BitDocSet(new OpenBitSet(solrIndexReader.maxDoc()));
        for (DocIterator it = in.iterator(); it.hasNext(); /* */)
        {
            matches.addUnique(it.nextDoc());
        }
    }
    openBitSet = matches.getBits();
    this.solrIndexReader = solrIndexReader;
    doc = solrIndexReader.getBase() - 1;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:20,代码来源:AbstractSolrCachingScorer.java

示例4: testMultiValued

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
@Test
public void testMultiValued() throws Exception {
  Query q = parse(COMPONENT_NAME_4);
  DocSet docs = searcher.getDocSet(q);

  assertEquals(4, docs.size());
  DocIterator it = docs.iterator();
  assertTrue(it.hasNext());
  assertEquals(0, it.nextDoc());
  assertTrue(it.hasNext());
  assertEquals(1, it.nextDoc());
  assertTrue(it.hasNext());
  assertEquals(2, it.nextDoc());
  assertTrue(it.hasNext());
  assertEquals(3, it.nextDoc());
  assertFalse(it.hasNext());    
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:18,代码来源:TestXJoinQParserPlugin.java

示例5: findParentIdsForNodes

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
private Map<String, Set<String>> findParentIdsForNodes(SolrIndexSearcher searcher, Collection<String> nodeIds) throws IOException {
	Map<String, Set<String>> parentIds = new HashMap<>();
	
	LOGGER.debug("Looking up parents for {} nodes", nodeIds.size());
	Query filter = buildFilterQuery(getNodeField(), nodeIds);
	LOGGER.trace("Filter query: {}", filter);
	
	DocSet docs = searcher.getDocSet(filter);
	
	for (DocIterator it = docs.iterator(); it.hasNext(); ) {
		Document doc = searcher.doc(it.nextDoc(), docFields);
		String nodeId = doc.get(getNodeField());
		
		Set<String> parentIdValues = new HashSet<>(Arrays.asList(doc.getValues(parentField)));
		parentIds.put(nodeId, parentIdValues);
		
		// Record the label, if required
		if (isLabelRequired(nodeId)) {
			recordLabel(nodeId, doc.getValues(getLabelField()));
		}
	}
	
	return parentIds;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:25,代码来源:ParentNodeFacetTreeBuilder.java

示例6: createDocumentClusters

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
private DblClusters<Document> createDocumentClusters(ResponseBuilder rb, int maxCount, Set<String> fields) throws IOException {
    DblClusters<Document> clusters = new DblClusters<>(2, maxCount);

    DocSet docSet = rb.getResults().docSet;
    DocIterator iterator = docSet.iterator();

    while (iterator.hasNext()) {
        Integer docId = iterator.next();
        Document doc = rb.req.getSearcher().doc(docId, fields);

        IndexableField latitudeField = doc.getField(this.fieldNameLat);
        IndexableField longitudeField = doc.getField(this.fieldNameLon);

        if (latitudeField == null || longitudeField == null) {
            continue;
        }

        String latitudeString = latitudeField.stringValue();
        String longitudeString = longitudeField.stringValue();

        if (!this.isNumeric(latitudeString) || !this.isNumeric(longitudeString)) {
            continue;
        }

        clusters.add(1, new double[] {Double.valueOf(latitudeString), Double.valueOf(longitudeString)}, doc);
    }
    return clusters;
}
 
开发者ID:Indoqa,项目名称:solr-spatial-clustering,代码行数:29,代码来源:SpatialClusteringComponent.java

示例7: shouldElementBeIgnored

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
private boolean shouldElementBeIgnored(long dbId, SolrIndexSearcher solrIndexSearcher, DocSet skippingDocs) throws IOException
{
    boolean result = false;

    if ((skipDescendantAuxDocsForSpecificTypes && !typesForSkippingDescendantAuxDocs.isEmpty())
            || (skipDescendantAuxDocsForSpecificAspects && !aspectsForSkippingDescendantAuxDocs.isEmpty()))
    {
        BooleanQuery query = new BooleanQuery();
        query.add(new TermQuery(new Term(QueryConstants.FIELD_DBID, NumericEncoder.encode(dbId))), Occur.MUST);

        DocSet docSet = solrIndexSearcher.getDocSet(query);

        int index = -1;
        if (docSet instanceof BitDocSet)
        {
            BitDocSet source = (BitDocSet) docSet;
            OpenBitSet openBitSet = source.getBits();
            index = openBitSet.nextSetBit(index + 1);
        }
        else
        {
            DocIterator it = docSet.iterator();
            if (it.hasNext())
            {
                index = it.nextDoc();
            }
        }

        result = (-1 != index) && skippingDocs.exists(index);
    }

    return result;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:34,代码来源:LegacySolrInformationServer.java

示例8: testSingleComponent

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
@Test
public void testSingleComponent() throws Exception {
  Query q = parse(COMPONENT_NAME);
  DocSet docs = searcher.getDocSet(q);

  assertEquals(2, docs.size());
  DocIterator it = docs.iterator();
  assertTrue(it.hasNext());
  assertEquals(1, it.nextDoc());
  assertTrue(it.hasNext());
  assertEquals(3, it.nextDoc());
  assertFalse(it.hasNext());
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:14,代码来源:TestXJoinQParserPlugin.java

示例9: testBooleanCombination

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
@Test
public void testBooleanCombination() throws Exception {
  Query q = parse(COMPONENT_NAME + " AND " + COMPONENT_NAME_2);
  DocSet docs = searcher.getDocSet(q);

  assertEquals(1, docs.size());
  DocIterator it = docs.iterator();
  assertTrue(it.hasNext());
  assertEquals(3, it.nextDoc());
  assertFalse(it.hasNext());    
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:12,代码来源:TestXJoinQParserPlugin.java

示例10: filterEntriesByField

import org.apache.solr.search.DocSet; //导入方法依赖的package包/类
/**
 * Fetch facets for items containing a specific set of values.
 * @param searcher the searcher for the collection being used.
 * @param facetValues the incoming values to use as filters.
 * @param filterField the item field containing the child values, which will be used
 * to filter against.
 * @return a map of node value to child values for the items.
 * @throws IOException
 */
private Map<String, Set<String>> filterEntriesByField(SolrIndexSearcher searcher, Collection<String> facetValues,
		String filterField) throws IOException {
	Map<String, Set<String>> filteredEntries = new HashMap<>();

	LOGGER.debug("Looking up {} entries in field {}", facetValues.size(), filterField);
	Query filter = buildFilterQuery(filterField, facetValues);
	LOGGER.trace("Filter query: {}", filter);

	DocSet docs = searcher.getDocSet(filter);

	for (DocIterator it = docs.iterator(); it.hasNext(); ) {
		Document doc = searcher.doc(it.nextDoc(), docFields);
		String nodeId = doc.get(getNodeField());
		
		// Get the children for the node, if necessary
		Set<String> childIds;
		if (filterField.equals(getNodeField())) {
			// Filtering on the node field - child IDs are redundant
			childIds = Collections.emptySet();
		} else {
			childIds = new HashSet<>(Arrays.asList(doc.getValues(filterField)));
			LOGGER.trace("Got {} children for node {}", childIds.size(), nodeId);
		}
		filteredEntries.put(nodeId, childIds);
		
		// Record the label, if required
		if (isLabelRequired(nodeId)) {
			recordLabel(nodeId, doc.getValues(getLabelField()));
		}
	}

	return filteredEntries;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:43,代码来源:ChildNodeFacetTreeBuilder.java


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