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 Markus Mehrwald <mm...@gmx.at> on 2010/06/12 02:53:35 UTC

Exact match with fuzzy query

Hi,

I am using lucene 3.0.1. I use a MultiFieldQueryParser with a 
GermanAnalyzer. In my index are some values among others one document 
with the title "bauer". I append to every word in my query a ~0.8 (here 
I am not sure if this is the way to do it). If I try to search now, I 
will not get the document with title "bauer" except I set the fuzzy 
value to very low values of about .3.
Do i have to perform two searches with and without the fuzzy parameter 
or can I do it somehow in one step like using "bauer~0.8 bauer" as query?
I saw that the parser cuts of the "er" if I am not using the fuzzy 
parameter. Can someone please tell my in a few words why? How can I do a 
fuzzy search which also finds exact matches?

Thanks,
Markus

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


Re: Exact match with fuzzy query

Posted by Ahmet Arslan <io...@yahoo.com>.
> > Yes bauer~0.8 bauer as query will bring you both exact
> and fuzzy matches.
> 
> Is this the normal way to do it?

Somehow. 'bauer~0.8 OR bauer' is easiest way to fuzzy search which also finds exact matches.


> Unfortunately this parser seems to be missing in 3.0.1

http://lucene.apache.org/java/3_0_1/api/contrib-misc/org/apache/lucene/queryParser/analyzing/AnalyzingQueryParser.html


      

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


Re: Exact match with fuzzy query

Posted by Markus Mehrwald <mm...@gmx.at>.

Am 12.06.2010 13:57, schrieb Ahmet Arslan:
>> I am using lucene 3.0.1. I use a MultiFieldQueryParser with
>> a GermanAnalyzer. In my index are some values among others
>> one document with the title "bauer". I append to every word
>> in my query a ~0.8 (here I am not sure if this is the way to
>> do it). If I try to search now, I will not get the document
>> with title "bauer" except I set the fuzzy value to very low
>> values of about .3.
>
>
>> Do i have to perform two searches with and without the
>> fuzzy parameter or can I do it somehow in one step like
>> using "bauer~0.8 bauer" as query?
>
> Yes bauer~0.8 bauer as query will bring you both exact and fuzzy matches.

Is this the normal way to do it?

>
>> I saw that the parser cuts of the "er" if I am not using
>> the fuzzy parameter. Can someone please tell my in a few
>> words why?
>
> This is answer of you question. FuzzyQuery is not analyzed. In your index you have bau, in your query you have bauer. Thats why 0.3 slop is required.
>
>> How can I do a fuzzy search which also finds exact matches?
>
> removing stemming from your analyzer can work.
>
> Or org.apache.lucene.queryParser.analyzing.AnalyzingQueryParser should work in your case.

Unfortunately this parser seems to be missing in 3.0.1

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

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


Re: Exact match with fuzzy query

Posted by Ahmet Arslan <io...@yahoo.com>.
> I am using lucene 3.0.1. I use a MultiFieldQueryParser with
> a GermanAnalyzer. In my index are some values among others
> one document with the title "bauer". I append to every word
> in my query a ~0.8 (here I am not sure if this is the way to
> do it). If I try to search now, I will not get the document
> with title "bauer" except I set the fuzzy value to very low
> values of about .3.


> Do i have to perform two searches with and without the
> fuzzy parameter or can I do it somehow in one step like
> using "bauer~0.8 bauer" as query?

Yes bauer~0.8 bauer as query will bring you both exact and fuzzy matches.

> I saw that the parser cuts of the "er" if I am not using
> the fuzzy parameter. Can someone please tell my in a few
> words why?

This is answer of you question. FuzzyQuery is not analyzed. In your index you have bau, in your query you have bauer. Thats why 0.3 slop is required.

> How can I do a fuzzy search which also finds exact matches?

removing stemming from your analyzer can work. 

Or org.apache.lucene.queryParser.analyzing.AnalyzingQueryParser should work in your case.





      

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