2

I want to add a Search box in a blogging website, specifically on a page where all the blogs appear in a "search results" component.

I've tried adding the SXA search box component and connecting it with the search results component, but when i try it out, I find that the search box is searching based on the names of the items in sitecore i.e. I have 5 blog post items named blog post 1/2/3/4/5, when i type in the search box "blog post" it shows me all 5 items.

What I need is a way to search using the fields inside those items, i.e. If i want to search using a "description" field or "summary" field etc.

2

Well, that's not exactly true. In SXA we've introduced new computed field - SXA Content - which is aggregating all texts from all fields of an item. Base on this it's not true that SXA is searching base on item names as it search on everything. Thanks to this there is no need to configure fields and other stuff, you just drop Search Box and Search Results on the page and search is working.

But on the other hand, this might be a small disadvantage in some cases - like you've described.

There is a feature to overcome this - dynamic search results boosting introduced in SXA 1.7. Create a scope and look on its fields. We've added there boosting field where you can create boosting rules. You can boost your description or summary fields so that those results will pop up at the beginning of the list.

Dynamic search results boosting is a quite powerful feature. I think you need to investigate it!

enter image description here

Here I'm boosting items under specific location which in Summary field will have at least what user entered in the Search Box:

enter image description here

  • hello! This isn't the norm i suppose, rather it's what happens with me : the blog template has several fields like "title" "summary" "date" etc, but at the very beginning, when i just linked the search box with the search results, it would only search with the item name in sitecore, it would even show them in the predictions as well, that is why i assumed that this is the norm. I have tried using the boosting feature after reading the answer, but now the search results are both, meaning it searches based on summary or title or, still, the item name in sitecore. Is there a way to remove that? – Mie ElMansy May 23 '18 at 10:17
  • At the moment not, SXA is using SXA Content aggregated field and you can't change that without custom implementation. Remember that you can boost results which have the value entered in the Search Box in the specific field. So in fact items which have user entered value in your fields will pop up at the beginning. I've updated my answer. – Dawid Rutkowski May 23 '18 at 10:31

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.