Reputation: 547
If I send a natural-language query to Retrieve and Rank (Solr), it will return an error if the query contains a colon. It seems to be attempting to interpret the word just prior to the colon as a field name.
Is there any way to prevent this, and are there other characters like this to which I should be aware?
Upvotes: 0
Views: 156
Reputation: 2765
The list of characters you'll need to handle is at http://www.ibm.com/watson/developercloud/doc/retrieve-rank/plugin_query_syntax.shtml - it's at the bottom of the page under the heading "Reserved characters". (This also includes how to handle them)
These include:
Colon (:)
Escape a colon in a query with a backslash.Double quotation marks (")
Escape double quotation marks in a query with a backslash in field queries.Backslash (\) Escape character
Escape a backslash in a query with another backslash.
Upvotes: 1
Reputation: 52882
You'll have to escape the colon - if your Solr library isn't doing this for you automagically. Escaping uses \
as in most other cases, so foo\:bar
should work. Another option might be to wrap the value in quotes (field:"foo:bar"
).
Upvotes: 0