On 9/13/2013 1:56 AM, Prasi S wrote:
I want to do regex search in solr.
E.g: Googl* . In my query api, i have used the ClientUtils.escapeQueryChars
funtion to escape characters special to solr.

In the above case, a search for
1. Google -> gives 677 records.
2. Googl* -> Escaped as Googl\* in code-> gives 12 results
3. When given q=Google* directly in the Browser -> gives 677 records.

Which is correct if I want to achieve regex search ( Googl*). Should i
restrict from escaping *, ? in the code for handling regex?
Your third example is using * as a wildcard.  That's NOT the same thing 
as regex.
If you sent q=/Google.*/ then that would be a regex that should do the 
same thing as your wildcard example.  This requires Solr 4.0 or later.
You can't use the escapeQueryChars method if you're wanting to do regex 
or wildcard search.  The point behind that escape method is to search 
for special characters rather than let them have their special meanings.
Thanks,
Shawn

Reply via email to