use of org.apache.camel.processor.lucene.support.Hit in project camel by apache.
the class LuceneSearcher method search.
public Hits search(String searchPhrase, int maxNumberOfHits, Version luceneVersion, boolean returnLuceneDocs) throws Exception {
Hits searchHits = new Hits();
int numberOfHits = doSearch(searchPhrase, maxNumberOfHits, luceneVersion);
searchHits.setNumberOfHits(numberOfHits);
for (ScoreDoc hit : hits) {
Document selectedDocument = indexSearcher.doc(hit.doc);
Hit aHit = new Hit();
if (returnLuceneDocs) {
aHit.setDocument(selectedDocument);
}
aHit.setHitLocation(hit.doc);
aHit.setScore(hit.score);
aHit.setData(selectedDocument.get("contents"));
searchHits.getHit().add(aHit);
}
return searchHits;
}