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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> wrote:
>
> It becomes a phrase query.
>
> Erick
>
> On 5/26/07, Mohammad Norouzi <[EMAIL PROTECTED]> 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/

Reply via email to