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 kumar <pa...@gmail.com> on 2013/10/15 13:48:35 UTC

Fuzzy Logic Implementation

Hi 


I have a situation that if a user has to spelt wrongly then also it has to
dispaly the results. 

i am using my query in the following way 

http://localhost:2012/solr/suggest?s=royal+enifld+bike&s1=royal~0.7+enifld~0.7+bike~0.7

first it has to check with "s"----if exact results are not found then it has
to check fuzzy logic with s1. 

Here "s" is working fine without spell mistake, i am getting excellent
results. but when i use fuzzy it is not showing exact results. 

Can anyone help me how to solve this problem. 


Regards, 
Kumar 



--
View this message in context: http://lucene.472066.n3.nabble.com/Fuzzy-Logic-Implementation-tp4095644.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Fuzzy Logic Implementation

Posted by kumar <pa...@gmail.com>.
Hi

I have 4-different scenarios to get the results as per my requirement. i am
using custom request handlers in the following way.


<requestHandler name="/suggest"
class="com.abc.solr.handler.MySearchHandler">
<arr name="components">
   <str>query</str>
   <str>debug</str>
  </arr>
  <lst name="defaults">
   <str name="c"></str>
   <str name="s"></str>
   <str name="s1"></str>
   <str name="fl">*,score</str>
   <str name="debugQuery">false</str>
   <str name="echoParams">all</str>
   <bool name="omitHeader">true</bool>
  </lst>
  <lst name="invariants">
  <int name="count">4</int>
  <str name="wt">json</str>

   <str name="1.q.op">AND</str>
   <str name="1.df">fsw_title</str>
   <str name="1.rows">10</str>
   <str name="1.q">{!edismax v=$s}</str>
   <str name="1.sort">mpId desc,score desc</str>
   <str name="1.fq">city:All OR _query_:"{!field f=city v=$c}"</str>
   <str name="1.fq">mpId:875 OR _query_:"{!field f=mpId v=$mp}"</str>
   <bool name="1.group">true</bool>
   <str name="1.group.field">mpId</str>
   <str name="1.group.limit">8</str>
   <bool name="1.group.main">true</bool>
   <str name="1.group.sort">mpId desc,score desc</str>
   <str name="1.defType">edismax</str>
   <bool name="1.lowercaseOperators">false</bool>
   <str name="1.qf">fsw_title^30.0 tsw_title^15.0 tf_title^10.0
tsw_keywords^1 keywords^0.5</str>
   <str name="1.pf2">fsw_title~1^50.0</str>
   <str name="1.pf3">fsw_title~1^25.0</str>
   <str name="1.bf">sum(product(typeId,100),weightage)</str>
   
   <str name="2.q.op">AND</str>
   <str name="2.df">fsw_title</str>
   <str name="2.rows">14</str>
   <str name="2.q">{!edismax v=$s}</str>
   <str name="2.sort">score desc</str>
   <str name="2.fq">city:All OR _query_:"{!field f=city v=$c}"</str>
   <bool name="2.group">true</bool>
   <str name="2.group.field">mpId</str>
   <str name="2.group.limit">4</str>
   <bool name="2.group.main">true</bool>
   <str name="2.group.sort">mpId desc,score desc</str>
   <str name="2.defType">edismax</str>
   <bool name="2.lowercaseOperators">false</bool>
   <str name="2.qf">fsw_title^30.0 tsw_title^15.0 tf_title^10.0
tsw_keywords^1 keywords^0.5</str>
   <str name="2.pf2">fsw_title~1^50.0</str>
   <str name="2.pf3">fsw_title~1^25.0</str>
   <str name="2.bf">sum(product(typeId,100),weightage)</str>
   
      
   <str name="3.q.op">AND</str>
   <str name="3.df">fsw_title</str>
   <str name="3.rows">10</str>
   <str name="3.q">{!edismax v=$s}</str>
   <str name="3.sort">score desc</str>
   <str name="3.fq">mpId:875 OR _query_:"{!field f=mpId v=$mp}"</str>
   <str name="3.defType">edismax</str>
   <bool name="3.lowercaseOperators">false</bool>
   <str name="3.qf">fsw_title^30.0 tsw_title^15.0 tf_title^10.0
tsw_keywords^1 keywords^0.5</str>
   <str name="3.pf2">fsw_title~1^50.0</str>
   <str name="3.pf3">fsw_title~1^25.0</str>
   <str name="3.bf">sum(product(typeId,100),weightage)</str>


   <str name="4.q.op">AND</str>
   <str name="4.df">fsw_title</str>
   <str name="4.rows">14</str>
   <str name="4.q">{!edismax v=$s}</str>
   <str name="4.sort">score desc</str>
   <bool name="4.group">true</bool>
   <str name="4.group.field">mpId</str>
   <str name="4.group.limit">4</str>
   <bool name="4.group.main">true</bool>
   <str name="4.group.sort">mpId desc,score desc</str>
   <str name="4.defType">edismax</str>
   <bool name="4.lowercaseOperators">false</bool>
   <str name="4.qf">fsw_title^30.0 tsw_title^15.0 tf_title^10.0
tsw_keywords^1 keywords^0.5</str>
   <str name="4.pf2">fsw_title~1^50.0</str>
   <str name="4.pf3">fsw_title~1^25.0</str>
   <str name="4.bf">sum(product(typeId,100),weightage)</str>
</lst>
</requestHandler>



can you please give me some idea how to configure spell check for the above
configuration.

 



--
View this message in context: http://lucene.472066.n3.nabble.com/Fuzzy-Logic-Implementation-tp4095644p4095768.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Fuzzy Logic Implementation

Posted by Developer <bb...@gmail.com>.
Use the spell check component with collation..

Example:

http://localhost:8983/solr/spell?q=delll
ultrashar&spellcheck=true&spellcheck.extendedResults=true&spellcheck.collate=true

http://wiki.apache.org/solr/SpellCheckComponent






--
View this message in context: http://lucene.472066.n3.nabble.com/Fuzzy-Logic-Implementation-tp4095644p4095738.html
Sent from the Solr - User mailing list archive at Nabble.com.