You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Husain, Yavar" <yh...@firstam.com> on 2012/07/19 13:29:31 UTC

NGram Indexing Basic Question

I have set some of my fields to be NGram Indexed. Have also set analyzer both at query as well as index level.

Most of the stuff works fine except for use cases where I simply interchange couple of characters.

For an example: "springfield" retrieves correct matches, "springfi" retrieves correct matches, "ingfield" retrieves correct matches.

However when i say "springfiedl" it returns 0 results. I debugged and found that at query/index level I have all correct N-Grams stored. So ideally it should match "springfie" (which is there both in Query NGram and Index NGram) and return me the correct results.

As I was busy so did not get time to look at the code for NGram. What ideally happens when I use NGram at Query level? Does it split the strings into N-Grams and then send each of them to Solr Server?

Thanks Sahi for your help yesterday. Appreciate that.
</PRE>
<BR>
******************************************************************************************<BR>This message may contain confidential or proprietary information intended only for the use of the<BR>addressee(s) named above or may contain information that is legally privileged. If you are<BR>not the intended addressee, or the person responsible for delivering it to the intended addressee,<BR>you are hereby notified that reading, disseminating, distributing or copying this message is strictly<BR>prohibited. If you have received this message by mistake, please immediately notify us by<BR>replying to the message and delete the original message and any copies immediately thereafter.<BR>
<BR>
Thank you.~<BR>
******************************************************************************************<BR>
FAFLD<BR>
<PRE>

RE: NGram Indexing Basic Question

Posted by "Husain, Yavar" <yh...@firstam.com>.
Thanks Erick. Actually it was going in as a phrase query. I set the following filter and things are perfect

<filter class="solr.PositionFilterFactory" />

-----Original Message-----
From: Erick Erickson [mailto:erickerickson@gmail.com] 
Sent: Friday, July 20, 2012 5:23 PM
To: solr-user@lucene.apache.org
Subject: Re: NGram Indexing Basic Question

Try attaching &debugQuery=on to your query and look at the parsed query. My first guess is that your default operator is AND (or a.op in modern terms) and the ngram with "dl" in it is required.

Please paste the results here if that's not the cause.

Best
Erick

On Thu, Jul 19, 2012 at 7:29 AM, Husain, Yavar <yh...@firstam.com> wrote:
> I have set some of my fields to be NGram Indexed. Have also set analyzer both at query as well as index level.
>
> Most of the stuff works fine except for use cases where I simply interchange couple of characters.
>
> For an example: "springfield" retrieves correct matches, "springfi" retrieves correct matches, "ingfield" retrieves correct matches.
>
> However when i say "springfiedl" it returns 0 results. I debugged and found that at query/index level I have all correct N-Grams stored. So ideally it should match "springfie" (which is there both in Query NGram and Index NGram) and return me the correct results.
>
> As I was busy so did not get time to look at the code for NGram. What ideally happens when I use NGram at Query level? Does it split the strings into N-Grams and then send each of them to Solr Server?
>
> Thanks Sahi for your help yesterday. Appreciate that.
> </PRE>
> <BR>
> **********************************************************************
> ********************<BR>This message may contain confidential or 
> proprietary information intended only for the use of 
> the<BR>addressee(s) named above or may contain information that is 
> legally privileged. If you are<BR>not the intended addressee, or the 
> person responsible for delivering it to the intended addressee,<BR>you 
> are hereby notified that reading, disseminating, distributing or 
> copying this message is strictly<BR>prohibited. If you have received 
> this message by mistake, please immediately notify us by<BR>replying 
> to the message and delete the original message and any copies immediately thereafter.<BR> <BR> Thank you.~<BR> ******************************************************************************************<BR>
> FAFLD<BR>
> <PRE>

Re: NGram Indexing Basic Question

Posted by Erick Erickson <er...@gmail.com>.
Try attaching &debugQuery=on to your query and look at the parsed
query. My first guess
is that your default operator is AND (or a.op in modern terms) and the
ngram with
"dl" in it is required.

Please paste the results here if that's not the cause.

Best
Erick

On Thu, Jul 19, 2012 at 7:29 AM, Husain, Yavar <yh...@firstam.com> wrote:
> I have set some of my fields to be NGram Indexed. Have also set analyzer both at query as well as index level.
>
> Most of the stuff works fine except for use cases where I simply interchange couple of characters.
>
> For an example: "springfield" retrieves correct matches, "springfi" retrieves correct matches, "ingfield" retrieves correct matches.
>
> However when i say "springfiedl" it returns 0 results. I debugged and found that at query/index level I have all correct N-Grams stored. So ideally it should match "springfie" (which is there both in Query NGram and Index NGram) and return me the correct results.
>
> As I was busy so did not get time to look at the code for NGram. What ideally happens when I use NGram at Query level? Does it split the strings into N-Grams and then send each of them to Solr Server?
>
> Thanks Sahi for your help yesterday. Appreciate that.
> </PRE>
> <BR>
> ******************************************************************************************<BR>This message may contain confidential or proprietary information intended only for the use of the<BR>addressee(s) named above or may contain information that is legally privileged. If you are<BR>not the intended addressee, or the person responsible for delivering it to the intended addressee,<BR>you are hereby notified that reading, disseminating, distributing or copying this message is strictly<BR>prohibited. If you have received this message by mistake, please immediately notify us by<BR>replying to the message and delete the original message and any copies immediately thereafter.<BR>
> <BR>
> Thank you.~<BR>
> ******************************************************************************************<BR>
> FAFLD<BR>
> <PRE>