Sounds like you need to call setDefaultOperator(AND_OPERATOR). See the javadocs for MultiFieldQueryParser constructors. They give examples.
Personally I tend to get confused with all the Should/Must/And/Or combinations with searches on multiple terms across multiple fields and wherever possible prefer to add a simple "keywords" or "contents" field to docs and just dump all the generally searchable terms in there. -- Ian. On Tue, Nov 30, 2010 at 11:42 AM, maven apache <apachemav...@gmail.com> wrote: > Hi: I have two documents: > > title body > Lucene In Action A high-performance, full-featured text search > engine library. > Lucene Practice Use lucene in your application > > Now,I search "lucene performance" using > > private String[] f = { "title", "body"}; > private Occur[] should = { Occur.SHOULD, Occur.SHOULD}; > Query q = MultiFieldQueryParser.parse(Version.LUCENE_29, "lucene > performance", f, should,new IKAnalyzer()); > > Then I get two hits: "Lucene In Action" and "Lucene Practice". > > However I do not want the "Lucene practice" in the search result. > > That's to say,I just want the documents who own all my search terms can be > returned,the "lucene parctice" does not contain the term "performance",so it > should not be returned. > > Any ideas? > > BTW,I do really cautioned when asking a new question in the list,but I > really have no idea after read the documents and googling,hoping not disturb > you guys. > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org