field : fields) {
bq.add(new TermQuery(new Term(field, word)), Occur.SHOULD);
}
}
Hits hits = indexSearcher.search(bq);
What's wrong? How to achieve the functionality?
Thanks in advance.
--
View this message in context:
http://www.nabble.com/AND-query-in-SHOULD-tf485571
On Donnerstag, 22. November 2007, Rapthor wrote:
> I want to realize a search that finds the exact phrase I provide.
You simply need to create a PhraseQuery.
See
http://lucene.zones.apache.org:8080/hudson/job/Lucene-Nightly/javadoc/org/apache/lucene/search/PhraseQuery.html
Regards
Daniel
--
scription, text, ...) and c) search
by a SHOULD restriction.
--
View this message in context:
http://www.nabble.com/AND-query-in-SHOULD-tf4855719.html#a13895700
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
-
To
n:green tree
>
> I don't understand how to a) search for combinations of words like "green
> tree", b) search in multiple fields (description, text, ...) and c) search
> by a SHOULD restriction.
> --
> View this messa
I get an exception:
> > java.lang.IllegalArgumentException: All phrase terms must be in the same
> > field: description:green tree
> >
> > I don't understand how to a) search for combinations of words like
> "green
> > tree", b) search in multi
r.SHOULD to the PhraseQuery. So
>> where
>> > does it go? I changed the source to look like this:
>> >
>> > PhraseQuery pq = new PhraseQuery();
>> > for (String word : words) {
>> >for (String field : fields) {
>> >
Rapthor <[EMAIL PROTECTED]> wrote:
> >>
> >> >
> >> > There is no option to provide an Occur.SHOULD to the PhraseQuery. So
> >> where
> >> > does it go? I changed the source to look like this:
> >> >
> >> > Phrase