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

SolrQuery issue while using filter query in code

former_member686625
Participant
0 Likes
876

In the code filter query is used to get the desired result. I wanted to add the few more condition but unable to do so as Hybris code is replacing space with +.

Existing code is something like below where target is "SolrQuery":

target.addFilterQuery((START.concat("boxCountValue_int_mv:").concat("[")
      .concat("22").concat(" TO ").concat("24").concat("]"))
      .concat(OR).concat(getLocalizedPackType().concat(END));

Translated query is:

fq=(boxCountValue_int_mv:[22+TO+24]+OR+PackageType_en_string_mv:Bagged+OR+PackageType_en_string_mv:BaggedGround+OR+PackageType_en_string_mv:Bagged+– +Ground)

SOLR Indexed values in PackageType is "Bagged" or "BaggedGround" or "Bagged - Ground".
In last value i.e. "Bagged - Ground" there is space before and after hyphen(-).

Products with this value "Bagged - Ground" are not coming in result.

Looks like issue is that SPACE is not getting considered in query.

In SOLR dashboard, fq=PackageType_en_string_mv:"Bagged – Ground" gives correct result.

What can I do in code?

I have tried passing value as "Bagged - Ground" or Bagged\ -\ Ground (used \ ). Nothing works.

Accepted Solutions (0)

Answers (0)