Search and relevance by document name and content
Hello ,
I want to make a search using lucene and having sorting by relevance amongs the document name and its content .
When I gather hits in TopDocs like :
Code:
QueryParser parserC = new QueryParser(Version.LUCENE_30, "contents", new StandardAnalyzer(Version.LUCENE_30));
QueryParser parserN = new QueryParser(Version.LUCENE_30, "filename", new StandardAnalyzer(Version.LUCENE_30));
QueryParser parserP = new QueryParser(Version.LUCENE_30, "fullpath", new StandardAnalyzer(Version.LUCENE_30))
Query queryC = parserC.parse(q);
Query queryN = parserN.parse(q);
Query queryP = parserP.parse(q);
TopDocs hits = is.search(queryC, 10);
hits = is.search(queryN, 10);
hits = is.search(queryP, 10);
The content of hits is replaced everytime and its value is is.search(queryP, 10)
Is there any method (like add or something or even a collector) to store all the results in one TopDocs hit and make a sort by relevance .
Thank you .
ps : excuse me for my very bad english .