本文整理汇总了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("---------------------------");
}
示例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");
}
}
示例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;
}