Julia
Julia

Reputation: 37

Displaying Search Results from Lucene with new version Lucene (6.0)

I am trying to created a servlet that uses Lucene. How would I display the results from indexSearcher as a list of document names or path names? It used to be in the older versions, you could just do searcher.getDocument(scoreDoc) to get a document which you can get then get names or pathnames from with document.get(string). The new version has gotten rid of getDocument and I am not really sure how to change scoreDocs or topDocs into documents so I can fetch relevant information.

Thanks!

Upvotes: 0

Views: 50

Answers (1)

knutwalker
knutwalker

Reputation: 5974

It's searcher.doc(int scoreDoc). This method returns the Document instance where you can call get to obtain the stored value.

Upvotes: 1

Related Questions