Search code examples
search-engineopensearch

Open Search Server v1.4 select query special characters


We're using Open Search Server v1.4. When the user enters a search for the text "Refrigerator temperature chart (5" we create a URL something like

http://10.192.16.160:8080/services/rest/select/search/<indexname/json?login=<login>&key=<apikey>template=search&query=Refrigerator%20temperature%20chart%20%285&start=0&rows=1000&filter=fileType%3afile&lang=ENGLISH

This fails with ...

HTTP Status 500 - org.apache.cxf.interceptor.Fault: com.jaeksoft.searchlib.SearchLibException: com.jaeksoft.searchlib.query.ParseException: org.apache.lucene.queryParser.ParseException: Cannot parse 'content:(Refrigerator temperature chart (5) OR content:("Refrigerator temperature chart (5") OR

So adding an escape character %5C before the open bracket fixes this query like so...

http://10.192.16.160:8080/services/rest/select/search/<indexname/json?login=<login>&key=<apikey>template=search&query=Refrigerator%20temperature%20chart%20%5C%285&start=0&rows=1000&filter=fileType%3afile&lang=ENGLISH

Can someone point me to some documentation that lists all the special characters that can be used in an Open Search select query that need to be escaped when entered as part of the search string?


Solution

  • Yes you are right, characters listed in section "Escaping Special Characters" in the page you linked also need to be escaped in OpenSearchServer.

    We recently released a fix allowing to escape those characters in query of type Search (field) for Searched fields configured with a pattern mode.

    Previously escaping of characters was only available in query of type Search (pattern). (more information of these two kind of queries here: http://www.opensearchserver.com/documentation/tutorials/functionalities.html#two-kinds-of-queries)

    Regards,

    Alexandre