lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: how to exact search?
Date Sat, 26 May 2007 14:52:39 GMT
Because "Test" is a phrase of exactly one word, so it matches both.
Assuming you indexed it with StandardAnalyzer, you indexed
tokens test, one, two. test got indexed for both docs. To the phrase
"test" matches both documents.

Your question is ambiguous. If you're asking how to return only
exact matches on the entire field, you'll have to index things
UN_TOKENIZED, then I'd use phrase queries to search. But you
won't then be able to get partial matches.

Best
Erick

On 5/26/07, Mohammad Norouzi <mnrz57@gmail.com> wrote:
>
> So why the field1:"Test" returns results with
> "Test one"
> "Test two"
>
> how can I tell lucene to return only "Test"
>
> On 5/26/07, Erick Erickson <erickerickson@gmail.com> wrote:
> >
> > It becomes a phrase query.
> >
> > Erick
> >
> > On 5/26/07, Mohammad Norouzi <mnrz57@gmail.com> wrote:
> > >
> > > Hi All
> > > I want to search an exact phrase, for example field1:"This is a Text"
> > > or by this query: field1:"Test"  returns the result that only contain
> > the
> > > word "Test" and not "Test one" or "Test two"
> > >
> > > I have a page that build a query and finally send that query to a
> > > MultiFieldQueryParser
> > > I have a class extends from MultiFieldQueryParser and override
> > > getRangeQuery
> > > to managing my range queries but there is something I cant understand
> > when
> > > the query is field1:Test  getFieldQuery() method will be called but
> when
> > > the
> > > query is field1:"Test" (with double quotes) neither of methods will be
> > > called!!!
> > >
> > > what happen when I use ( " ) in the query? and how can I catch it to
> use
> > a
> > > PhraseQuery to exact search?
> > >
> > >
> > > Thank you very much
> > >
> > >
> > > --
> > > Regards,
> > > Mohammad
> > > --------------------------
> > > see my blog: http://brainable.blogspot.com/
> > >
> >
>
>
>
> --
> Regards,
> Mohammad
> --------------------------
> see my blog: http://brainable.blogspot.com/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message