Asterisk and question mark are wildcards, not regex. Regex query is a regular expression enclosed in slashes, such as:

q=/Googl.*/

And note that not all analyzer filters will be applied to regex terms. You may need to do the analysis yourself. Although simple filters likethe lower case filter should work fine.

-- Jack Krupansky

-----Original Message----- From: Prasi S
Sent: Friday, September 13, 2013 3:56 AM
To: solr-user@lucene.apache.org
Subject: Escaping *, ? in Solr

Hi,
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?

Pls suggest.

Thanks,
Prasi.

Reply via email to