In solr I want to search one field with negative number like nodeId:-1. in schema.xml, I defined it like this: <field name="nodeId" type="int" indexed="true" stored="true" />
solr throws error when use "nodeId:-1" to search like this: org.apache.lucene.queryParser.ParseException: Cannot parse 'storeId:-1': Encountered " "-" "- "" at line 1, column 8. Was expecting one of: "(" ... "*" ... ... ... ... ... "[" ... "{" ... ...
I must search with storeId:\-1 or storeId:"-1" to get answer.
now the question is : Can I modify any solr configration files to search without any escape characters? Or another way to resolve this problem without modify java code. Thanks.
I personally think escaping properly inside your Java code is the better way. ClientUtils.escapeQueryChars would be the method of choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With