0

We are using Solrnet to issue a compound query to Solr based on a set of options that the user can select for e.g. phrase, exact phrase. exclusion, proximity, etc. We are creating the individual queries based on the options selected using the SolrQueryByField API and combining the combination using a SolrMultipleCriteriaQuery with the AND operator. But when we submit the query to Solr, the q parameter that gets submitted is having the + sign added accross all the terms:

q=(ContentSearch:(roman)+AND+ContentSearch:("test+case")+AND+-ContentSearch:(wine)+AND+(ContentSearch:(A)+OR+ContentSearch:(B))+AND+ContentSearch:("catacombs+wine"~5)+AND+ContentSearch:([10+TO+20]))}

The +AND+ or "test+case" or +AND+- or 10+TO+20 is messing up the query parser. Has anybody encountered this before? Is it something to do with the url encoding when solrnet is sending the request to solr?

koder
  • 887
  • 9
  • 29

1 Answers1

0

If you are using SolrNet 0.4.0 you can set an optional parameter on the SolrQueryByField Quoted=false this will stop the default behavior of QueryByField to escape special characters.

Paige Cook
  • 22,415
  • 3
  • 57
  • 68
  • I have done that .... but still it shows the same behaviour. Not sure why it is adding the + to each of the query clauses and even between the query terms. – koder Feb 19 '13 at 17:36
  • Ah, I see. I am not sure why it is adding the + to each of the query clauses. Might be some embedded special character escaping built into SolrNet. – Paige Cook Feb 19 '13 at 20:20
  • Based on a previous question on the SolrNet Google Group - https://groups.google.com/forum/?fromgroups=#!searchin/solrnet/solrmultiplecriteriaquery/solrnet/zXDIRverHOg/gGRpXaps-8kJ You might consider using edismax and let Solr handle things for you. – Paige Cook Feb 20 '13 at 13:24
  • As mentionned by Mauricio Scheffer, "+" character is only a space encoded in your url request – Eric Bonnot Feb 26 '15 at 07:19