: -ID:0 Category:Category1 Category:Category2 : : What I hope this says is : : "Give me all documents whose ID is not "0" AND which have a Category Field : which contains "Category1" or "Category2"
That's what you've got. If it's not matching what you expect it to, then i'm guessing your index wasn't built the way you expect. : How do I do that? As a jar file with the relevent source code in it? Posted : as an attachment to this mailing list? Just doing a cut/paste inline is fine (the mailing list software doesn't like most attachments). Here's an example of what you're talking about that seems to work just fine for me... public void sampleTest() throws Exception { Directory dir = new RAMDirectory(); IndexWriter w = new IndexWriter(dir,new WhitespaceAnalyzer(),true); Document d = new Document(); d.add(Field.Keyword("ID","0")); w.addDocument(d); d = new Document(); d.add(Field.Keyword("Category","Category1")); w.addDocument(d); d = new Document(); d.add(Field.Keyword("Category","Category1")); d.add(Field.Keyword("Category","Category2")); w.addDocument(d); d = new Document(); d.add(Field.Keyword("Category","Category2")); w.addDocument(d); d = new Document(); d.add(Field.Keyword("bogus","don't match")); w.addDocument(d); w.close(); IndexSearcher s = new IndexSearcher(dir); BooleanQuery q = new BooleanQuery(); q.add(new TermQuery(new Term("ID","0")),false,true); q.add(new TermQuery(new Term("Category","Category1")),false,false); q.add(new TermQuery(new Term("Category","Category2")),false,false); assertEquals(3, s.search(q).length()); } -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]