I have a wildcard query that looks something like:
q=location:los a*
I'd like it to match "los angeles" and "los altos". A query like:
q=los*
Works just fine, but as soon as I add whitespace I get no results. How I can use whitespace in my wildcard queries?
I've recently come across this problem myself, and it seems that all you need to do is escape the space in your query. Your original query would be interpreted by Solr as something like this:
location:los id:a*
(assuming "id" is your default search field)
However, if you were to write your query as:
location:los\ a*
Then it would end up being parsed as:
location:los a*
And the above should yield the results that you desire (assuming your data is properly indexed).
Tip: Figuring all this out is simple. Just add &debugQuery=on
to the end of the url you use when submitting your query to see how it was parsed by Solr.