Hi, I have following dataset indexed in Lucene. 2010-04-21 02:24:01 GET /blank 200 120 2010-04-21 02:24:01 GET /US/registrationFrame 200 605 2010-04-21 02:24:02 GET /US/kids/boys 200 785 2010-04-21 02:24:02 POST /blank 304 56 2010-04-21 02:24:04 GET /blank 304 233 2010-04-21 02:24:04 GET /blank 500 567 2010-04-21 02:24:04 GET /blank 200 897 2010-04-21 02:24:04 POST /blank 200 567 2010-04-21 02:24:05 GET /US/search 200 658 2010-04-21 02:24:05 POST /US/shop 200 768 2010-04-21 02:24:05 GET /blank 200 347
I am querying it in two ways, first with QueryParser and other with BooleanQuery. *QueryParser version:* Query q = new QueryParser(version, "cs-method", new StandardAnalyzer(version)).parse("cs-method:GET AND cs-uri:/blank"); *BooleanQuery version:* BooleanQuery q = new BooleanQuery(); q.add(new TermQuery(new Term("cs-method", "GET"), BooleanClause.Occur.SHOULD); q.add(new TermQuery(new Term("cs-uri", "/blank"), BooleanClause.Occur.SHOULD); When I run the two version, I am able to match the documents with the QueryParser version, but not with BooleanQuery. The output is as follows: *QueryParser output:* Total Number of Documents - 11 Query --> +cs-method:get +cs-uri:blank Total Clues Found - 5 *BooleanQuery output:* Total Number of Documents - 11 Query --> cs-method:GET cs-uri:/blank Total Clues Found - 0 Does anybody know why the BooleanQuery doesn't return any documents while QueryParser does? Also, how can I change the BooleanQuery to work for the above case? -- With Regards, Deepak Shakya