Hi!
I have documents with two fields id and name. I create index with code:
Document doc = new Document();
doc.add(new TextField("id", id), Store.YES));
doc.add(new TextField("name", QueryParser.escape(name), Store.YES));
indexWriter.addDocument(doc);

When I try to search with query with code:
QueryParser qp = new QueryParser(LUCENE_VERSION, "name", new 
WhitespaceAnalyzer(LUCENE_VERSION));
getIndexSearcher().search(qp.parse(“id:( 134586 or  134583 )”), 10);
I got only 2 results as expected

But when I try to search with query:
(name:test) and id:( 134586 or  134583 )
I got many results, but I expect only documents with id  =  134586 or  134583  
which have test in name field. Why lucene add to search results additional 
documents which not match search criteria?


--
Krasovskiy Maxim

Reply via email to