in indexer-core/src/main/java/org/apache/maven/index/DefaultIteratorResultSet.java [192:245]
protected ArtifactInfo createNextAi() throws IOException {
ArtifactInfo result = null;
// we should stop if:
// a) we found what we want
// b) pointer advanced over more documents that user requested
// c) pointer advanced over more documents that hits has
// or we found what we need
while ((result == null) && (pointer < maxRecPointer) && (pointer < hits.scoreDocs.length)) {
Document doc = indexSearcher.doc(hits.scoreDocs[pointer].doc);
IndexingContext context = getIndexingContextForPointer(doc, hits.scoreDocs[pointer].doc);
result = IndexUtils.constructArtifactInfo(doc, context);
if (result != null) {
// WARNING: NOT FOR PRODUCTION SYSTEMS, THIS IS VERY COSTLY OPERATION
// For debugging only!!!
if (searchRequest.isLuceneExplain()) {
result.getAttributes()
.put(
Explanation.class.getName(),
indexSearcher
.explain(searchRequest.getQuery(), hits.scoreDocs[pointer].doc)
.toString());
}
result.setLuceneScore(hits.scoreDocs[pointer].score);
result.setRepository(context.getRepositoryId());
result.setContext(context.getId());
if (filter != null) {
if (!filter.accepts(context, result)) {
result = null;
}
}
if (result != null && postprocessor != null) {
postprocessor.postprocess(context, result);
}
if (result != null && matchHighlightRequests.size() > 0) {
calculateHighlights(context, doc, result);
}
}
pointer++;
processedArtifactInfoCount++;
}
return result;
}