2

I am trying add a query to my SXA Search Scope Query, but it is giving 0 Results. When I check in the Search Logs, I can see the below Log.

?q=((((_path:("64a826d58a374bd9be60bff956a89a47") AND _template:("60beb47fc046428ca9faac88164a8561")) AND expirationdate_tdt:(\[NOW\-1DAY\/DAY\ TO\ *\])) AND _datasource:("sitecore")) AND _latestversion:("1")) AND _val_:__boost&start=0&rows=0&fq=_indexname:(sitecore_master_index)&facet=true&facet.field=_templatename&f._templatename.facet.mincount=1&facet.field=culture_s&f.culture_s.facet.mincount=1&facet.field=parsedcreatedby_s&f.parsedcreatedby_s.facet.mincount=1&facet.field=__smallcreateddate_tdt&f.__smallcreateddate_tdt.facet.mincount=1&wt=xml

The same query returns 0 results in SOLR as well. But when I modify the query to as below, it works.

?q=((((_path:("64a826d58a374bd9be60bff956a89a47") AND _template:("60beb47fc046428ca9faac88164a8561")) AND expirationdate_tdt:([NOW-1DAY/DAY TO *])) AND _datasource:("sitecore")) AND _latestversion:("1")) AND _val_:__boost&start=0&rows=0&fq=_indexname:(sitecore_master_index)&facet=true&facet.field=_templatename&f._templatename.facet.mincount=1&facet.field=culture_s&f.culture_s.facet.mincount=1&facet.field=parsedcreatedby_s&f.parsedcreatedby_s.facet.mincount=1&facet.field=__smallcreateddate_tdt&f.__smallcreateddate_tdt.facet.mincount=1&wt=xml

The only difference I can see is with the expirationdate_tdt field in both queries. The one Sitecore sends to SOLR is build like -- expirationdate_tdt:(\[NOW\-1DAY\/DAY\ TO\ *\]) However, the correct one should be like -- expirationdate_tdt:([NOW-1DAY/DAY TO *])

I have added the correct one as query in SXA Search Scope Query. Does anyone have any idea why it is transformed into the wrong one? Anyway we can stop that from happening?

Thanks Sharad

1 Answer 1

0

Recently we were also facing simmilar issue with the sitecore 10 where our the field vlaue contains a yyy-zzz a hyphen in between however the solr is indexing it as seperate terms "yyyy" and "zzz".

and hence we are contructing our queries like case_t=("yyyy-zzz") and in solr it constructs like case_t(yyyy zzz) which gives us wrong results.

The way we fix it by adding filed as a string.

<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="case_t" returnType="string" />
</fieldNames>

As a result, the value of the field will be indexed as a single term making it impossible to find a match using queries like

case_t="yyy-zzz "

refered to these release notes:- https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/101/Sitecore%20Experience%20Platform%20101/Release%20Notes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.