Hi,

I have the following documents

Document doc1 = new Document();
doc1.add(new Field("searchText", "ABC Takeaway f...@company.com
f...@company.com", Field.Store.YES, Field.Index.ANALYZED));
Document doc2 = new Document();
doc2.add(new Field("searchText", "XYZ Takeaway f...@company.com",
Field.Store.YES, Field.Index.ANALYZED));
Document doc3 = new Document();
doc2.add(new Field("searchText", "LMN Takeaway", Field.Store.YES,
Field.Index.ANALYZED));

My query is

Query q = new QueryParser(Version.LUCENE_35, "searchText",
analyzer).parse("+Takeaway f...@company.com^100");

This returns only doc1 and doc2. How do I need to modify the query, so that
the first term (Takeaway) is mandatory and the second one (f...@company.com)
is optional? Also, I would like to boost those documents based on the
number of occurrences of the second term.

Regards
Meeraj

Reply via email to