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 Mile Rosu <mi...@level7.ro> on 2007/02/06 14:14:31 UTC

Retrieving exact matches

Hello,


I have been looking in the documentation but haven't found a solution to 
this:

is there a way to retrieve only the record "picasso" when the query is 
picasso and not the records: "picasso","picasso pablo"  ie a 100% match 
of the query ?


Thank you,
Mile Rosu



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


Re: Retrieving exact matches

Posted by Erick Erickson <er...@gmail.com>.
One way to do this is to store the fields UN_TOKENIZED (and be careful to
index and search with compatible Analyzers!!) Also, watch your
capitalization. But this is a bit tricky, since if you index UN_TOKENIZED,
you would never get a match for your second document above unless you
searched on "picasso pablo". In particular, what if you were searching on
"picasso, pablo"? Since the comma is not stripped (the search terms being
UN_TOKENIZED), it wouldn't match your second document above. You can get
around this with some pre-processing, but be aware that when you are asking
for exact matches using UN_TOKENIZED fields, you really have to be careful
about how you handle these kinds of situations. This is true when indexing
AND when searching.

Also, this is suitable only for pretty strictly defined fields. You might
find yourself indexing the same data several different ways if you sometimes
want to search on exact phrases and sometimes on partial...

But I don't understand your example and I'm assuming that you'd want one
match in your example, but not two.


Best
Erick

On 2/6/07, Mile Rosu <mi...@level7.ro> wrote:
>
>
> Hello,
>
>
> I have been looking in the documentation but haven't found a solution to
> this:
>
> is there a way to retrieve only the record "picasso" when the query is
> picasso and not the records: "picasso","picasso pablo"  ie a 100% match
> of the query ?
>
>
> Thank you,
> Mile Rosu
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>