cao li ma. 2010/7/7 Erick Erickson <erickerick...@gmail.com>
> That's not the meaning of phrase query at all. Searching for a phrase > implies proximity. That is, searching for name:"Tom Jones" requires that > these two terms appear next to each other, whereas > name:Tom AND name:Jones merely requires that the two terms > appear anywhere in the field, no matter how many other terms > are between them. I.e. indexing "tom sawyer huck finn and steve jones" > in a field would match > name:tom AND name:jones > but would not match > name:"tom jones" > > You can control how close phrase terms must be by using the > tilde operator, i.e. name:"tom jones"~3. > > Here's a start... > http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Grouping > > HTH > Erick > > On Tue, Jul 6, 2010 at 4:18 PM, Thomas Nguyen <tsx...@gmail.com> wrote: > > > Hello All, > > > > Can someone explain to me how fielded queries work with phrases? My > > first thought is that the phrase is broken down into terms and those > > terms are then fielded and separated with the AND operator. An > > example would be the following: > > > > name:"Tom Jones" --> name:"Tom" AND name:"Jones" > > > > I found out that isn't correct as the original query didn't returned > > any results while the second query did. So then I tried changing the > > AND to OR in the second query to see if it's equivalent to the > > original query. The OR query did return results so it can't be > > equivalent. Any insight would be helpful. > > > > - Thanks > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > >