2
votes

I'm trying to find documents containing asterisks/query marks in Solr text field using Edismax parser. Everything works perfectly when I search for usual text (fq={!edismax}textfield:*sometext*) or even for any other special Lucene character using escaping (fq={!edismax}textfield:*\~*).

However when searching for * (fq={!edismax}textfield:*\**) or ? (fq={!edismax}textfield:*\?*) these characters seem not to be escaped, since all documents are returned. I try also URL encoding for escaped characters (like \%2A instead of \*), however the result is the same.

The problem appear to concern leading wildcards only, since fq={!edismax}textfield:\** and fq={!edismax}textfield:\?* return correct results, but fq={!edismax}textfield:*\* and fq={!edismax}textfield:*\? do not (as well as fq={!edismax}textfield:*sometext\* etc.).

How is it possible to search for */? using Edismax with leading asterisk wildcard?

1

1 Answers

0
votes

Quoting the asterisk works for me. This query finds two books in my index with a standalone asterisk in the title:

title:"*"

Here is the title of one of them: "Be * Know * Do, Adapted from the Official Army Leadership Manual".

I'm using a edismax with Solr 3.3.