I am trying to construct, via individual query api, a query to search for documents with a field name of "Category" and a value of either "Category1" OR "Category2" (or both).
My code to do this (given categories is the set of strings with the category names I wish to search for) is as follows BooleanQuery query = new BooleanQuery(); if (categories != null && !categories.isEmpty()) { for (String category : categories) { TermQuery t =new TermQuery(new Term("Category",category)); query.add(t,false,false); //Saywould like that category } } I have three documents in the index Document 1 has zero fields called "Category" Document 2 has one keyword field called "Category" with value "Category1" Document 3 has two keyword fields called "Category", one with a value of "Category1" and the other with a value of "Category2" When I run a search with the above query, I get only one hit instead of the expected 2. (Hits.length()=1) Worse than that, when I attempt to access Hits.doc(0) I am getting an immediate IOException with the message "Bad file descriptor". I think this must be because by that time I have closed the indexSearcher (and therefore the Reader that sat behind it). Its not clear to me how hits are associated with a reader. Is it possible to close the reader and then re-open it later to access a document with the hit? -- Alan Chandler http://www.chandlerfamily.org.uk Open Source. It's the difference between trust and antitrust. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]