cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Solr Query is replacing with '&' and '=' with '%26' and '%3D' and not giving the expected results

Former Member
0 Kudos
468

Hi experts,

I have written code as follows

 final SolrQuery sq = new SolrQuery();
             final String query = "(code_string:BR171 OR code_string:BR179 OR code_string:12491-4628437 OR code_string:MG1174 OR code_string:8355-6972261)&fl=code_string,name_text_en";
             sq.setQuery(query);

and query is converting as

 q=(code_string:BR171+OR+code_string:BR179+OR+code_string:12491-4628437+OR+code_string:MG1174+OR+code_string:8355-6972261)%26fl%3Dcode_string,name_text_en

because of that replacement for & and = with %26 and %3D, I am not getting the expected results.

How can I overcome this ?

Thanks,

Venki

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Venki,

You can try splitting up the actual query and the fields (fl). SolrQuery has a "setFields" that you can use to set a number of fields. Then you won't need & and = anymore.