lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Madhav Bahuguna <madhav.bahug...@gmail.com>
Subject How to handle special characters in fuzzy search query
Date Fri, 08 May 2015 06:28:02 GMT
So my solr query is implemented in two parts,first query does an exact
search if there are no results found for exact then it goes to the second
query that does a fuzzy search.
every things works fine but in situations like-->A user enters "burg +"
So in exact search no records will come,so second query is called to do a
fuzzy search.Now comes the problem my fuzzy query does not understand
special characters like +,-* which throws and error.If i dont pass special
characters it works fine.  But in real world a user can put characters with
their search,which will throw an error.
Now iam stuck in this and dont know how to resolve this issue.
This is how my exact search query looks like

    $query1="(business_name:$data*^100 OR city_name:$data*^1 OR
    locality_name:$data*^6 OR business_search_tag_name:$data*^8 OR
    type_name:$data*^7) AND (business_active_flag:1) AND
    (business_visible_flag:1) AND (delete_status_businessmasters:0)";

This is how my fuzzy query looks like


$query2='(_query_:%20"{!complexphrase%20qf=business_name^100+type_name^0.4+locality_name^6%27}%20'.$url_new.')AND(business_active_flag:1)AND(business_point:[1.5
TO 2.0])&q.op=AND&wt=json&indent=true';

Iam new to solr and dont know how to tackle this situation.

Details
Solrphpclient
php
solr 4.9


-- 
Regards
Madhav Bahuguna

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message