0

When using sxa:ItemsWithTheSameValueInField|Fieldname with droplink field it is not filtering in search scope for example when adding in search scope :

sxa:ItemsWithTheSameValueInField|category

where the category is a droplink in the template of the context item, is the syntax above correct or should be added in a different way?

0

The syntax looks fine.

I will write a few validation steps to help you.

Validate query

Check your logs to see how Search Queries look like.

For my token configured in a following way:

sxa:ItemsWithTheSameValueInField|Test

I've got the following query:

12996 19:42:15 INFO ExecuteQueryAgainstLucene (sitecore_sxa_web_index): +_latestversion:1 +(+(+_path:0dae33a26f53473e8abdb054d9bf3b75 +searchable:1) +test:de30ff2da089418bb4922855609a3537)

Notice this part: +test:de30ff2da089418bb4922855609a3537

My context item where I execute the query from: enter image description here

If your field is not in a query then it means that your context item does not contain this field. If it does and it looks good then move to a next step.

Check index content

Make sure that your field is stored in the SXA index.

You can find your index against which you fire search queries when you open chrome dev tools:

enter image description here

My field looks like this:

enter image description here

Values in the index must be "comparable" with those from search queries.

If for example, your category field is a computed field, it will not work (normalized raw field value from an item has to be comparable with values in the index).

| improve this answer | |
  • In sitecore 9.0 with Solr 6.6.2, the mapping of droplink field is stringcollection in sitecore configuration while when the column is indexed it is indexed like string so the query was constructed like "fieldname_sm" while solr index field as "fieldname_s" so the query was returning no data – NAli Jun 29 '18 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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