solrluceneriak

List of forbidden character in Lucene query for Solr


I got a setup of a Solr search engine on a Riak database. When I am trying to realize a search with the following query:

my_field:#

I a paring query error from Solr

I also tried to query as follow

my_field:"#"

Edit:

I finnaly found a solution for the # character. (By encoding it with the URI code %23).

Is there a complete list of forbidden character in Lucene query for Solr?


Solution

  • You problem is not that "#" is a forbidden character in Solr queries, but the way you are running the query — using a browser, probably from the built-in Solr console in Riak.

    This character requires encoding when sent in a URL (see Percent-encoding in a URI, RFC 3986). In which case you solution is the right one. The full list is:

    ! # $ & ' ( ) * + , / : ; = ? @ [ ]
    

    However, it is not forbidden in Solr queries according to Escaping Special Characters of the latest Solr Ref Guide:

    + - && || ! ( ) { } [ ] ^ " ~ * ? : /
    

    You should not have this problem when sending the query programmatically.