0
votes

I'm using Solr 6.1.0

When I use defType=edismax, and using debug mode by setting debug=True, I found that the search for "r&d" is actually done to search on just the character "r".

http://localhost:8983/solr/collection1/highlight?q="r&d"&debugQuery=true&defType=edismax

"debug":{
  "rawquerystring":"\"r",
  "querystring":"\"r",
  "parsedquery":"(+DisjunctionMaxQuery((text:r)))/no_coord",
  "parsedquery_toString":"+(text:r)"

Even if I search with escape character, it is of no help.

http://localhost:8983/solr/collection1/highlight?q="r\&d"&debugQuery=true&defType=edismax

"debug":{
  "rawquerystring":"\"r\\",
  "querystring":"\"r\\",
  "parsedquery":"(+DisjunctionMaxQuery((text:r)))/no_coord",
  "parsedquery_toString":"+(text:r)",

But if I'm using other symbols like "r*d", then the search is ok.

http://localhost:8983/solr/collection1/highlight?q="r*d"&debugQuery=true&defType=edismax

"debug":{
   "rawquerystring":"\"r*d\"",
   "querystring":"\"r*d\"",
   "parsedquery":"(+DisjunctionMaxQuery((text:\"r d\")))/no_coord",
   "parsedquery_toString":"+(text:\"r d\")",

What could be the reason behind this?

Regards,
Edwin

2

2 Answers

0
votes

First - if you're using the URL as you've pasted, & is the separator between different arguments in the URL, and have to be properly urlencoded if it belongs to an argument, and is not an argument separator.

q=text:"foo&bar"&fl=..

is parsed as

q=text:"foo
bar"
fl=..

Your Solr library usually handles this for you transparently. text%3A%22r%26d%22 is the urlencoded version of text:"r&d".

Secondly, any further parsing will depend on the analysis chain and tokenizer for the field you're searching. This determines which characters are kept and how the text is tokenized (split into separate tokens) before the tokens are matched between the querying text and the indexed text.

0
votes

What Analyzer are you using for your field . Better try a Analyzer that doesn't tokenize your field much like KeyWordTokenizerFactory.