You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Rajiv Roopan <ra...@gmail.com> on 2007/03/19 16:02:58 UTC

Trouble w/ Query Creation

Hello, I'm having some issues making the correct query. This is my current
situation.

I'm searching for :"foo bar" in 3 fields:

In the index I have:

document 1.
field1 contains (boost is 2.0): "bar stuff"
field2 contains: "bar max"
field3 contains: ""

document 2.
field1 contains (boost is 2.0): "foo bar stuff"
field2 contains: ""
field3 contains: "fbs"

I'm looking to get document 2 as the first result since it contains all the
words I'm searching for but this is not what happens.

I currently have a boolean query which contains a MultiFieldQuery  for all
three fields and a Prefix query for field1.  This config doesn't seem to
work. Any help would be appreciated.

Rajiv

Re: Trouble w/ Query Creation

Posted by Chris Hostetter <ho...@fucit.org>.
: I currently have a boolean query which contains a MultiFieldQuery  for all

MultiFieldQuery is not a query class that comes with Lucene ... did you
write it yourself?

it sounds like what you want is a boolean query (of a
DisjunctionMaxQuery) containing a seperate phrase query for each field ...
if you just do term queries you might not get the order you want if one of
hte "words" apperas a lot more often (and in more fields) then the other.




-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org