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


Java DocIterator.next方法代码示例

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


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

示例1: printDocIDs

import org.apache.solr.search.DocIterator; //导入方法依赖的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: transform

import org.apache.solr.search.DocIterator; //导入方法依赖的package包/类
@Override
public void transform(SolrDocument doc, int docid) {

  FieldType idFt = idField.getType();
  Object parentIdField = doc.getFirstValue(idField.getName());
  
  String parentIdExt = parentIdField instanceof IndexableField
    ? idFt.toExternal((IndexableField)parentIdField)
    : parentIdField.toString();

  try {
    Query parentQuery = idFt.getFieldQuery(null, idField, parentIdExt);
    Query query = new ToChildBlockJoinQuery(parentQuery, parentsFilter, false);
    DocList children = context.searcher.getDocList(query, childFilterQuery, new Sort(), 0, limit);
    if(children.matches() > 0) {
      DocIterator i = children.iterator();
      while(i.hasNext()) {
        Integer childDocNum = i.next();
        Document childDoc = context.searcher.doc(childDocNum);
        SolrDocument solrChildDoc = ResponseWriterUtil.toSolrDocument(childDoc, schema);

        // TODO: future enhancement...
        // support an fl local param in the transformer, which is used to build
        // a private ReturnFields instance that we use to prune unwanted field 
        // names from solrChildDoc
        doc.addChildDocument(solrChildDoc);
      }
    }
    
  } catch (IOException e) {
    doc.put(name, "Could not fetch child Documents");
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:34,代码来源:ChildDocTransformerFactory.java

示例3: createDocumentClusters

import org.apache.solr.search.DocIterator; //导入方法依赖的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


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