Edit TopfieldDocs in Lucene
Hi,
I am doing a search using Lucene but for certain phrases I am not getting an exact match. To counter this, I am looking at the number of times the query (phrase to search) occurs in the Document. For documents with "0" hits, I want to delete the entry. How do I do this?
Code:
//Initiated somewhere in the code
TopFieldDocs topFieldDocs = null;
multiSearcher = new MultiSearcher(indexSearchers);
analyzer = new StandardAnalyzer(Version.LUCENE_34);
queryParser = new QueryParser(Version.LUCENE_34, "path", analyzer);
topFieldDocs = multiSearcher.search(query, filter, request.getHitStart() + request.getMax(), sortByDate);
if (count==0) //count is the number of times query occurs in the document
{
delete from topFieldDocs;
}
else
{
// Display Result
}
Thank You for the help
Re: Edit TopfieldDocs in Lucene