2

I need to pass in a value that's being pulled from the contact db for each user on the site to filter search results. We only want users to see search results that are in the proper context.

Is it possible to add a facet to the url programatically before the js api call happens? I've tried to do this by adding a pipeline method just after ProcessItem but it doesn't work. Is there another part of the pipeline I should look at?

1

There is nothing like this out of the box. I would suggest writing Search Token, SXA has a couple of pre-defined ones. Just click Build query in the scope item, type SXA and you will see something like this:

enter image description here

You can write your custom one which will take data from Contact Database for each user. And the results will be filtered by those values. Take a look at Sitecore.XA.Foundation.TokenResolution.Pipelines.ResolveTokens. Investigating Sitecore.XA.Foundation.TokenResolution.Pipelines.ResolveTokens.ResolveTokensProcessor base processor class might also help.

| improve this answer | |
  • Thanks for the response! To confirm though, these tokens are only available in SXA 1.7 and above right? We're currently on 1.4. – Jason Davidson Dec 18 '18 at 16:50
  • Damn.... 1.4!? It was like in the previous century:) You should update as fast as you can! – Dawid Rutkowski Dec 19 '18 at 11:52

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.