I'm using Sitecore 9.1 and SXA 1.8, I implemented search functionality using Search box and Search results OOB SXA components, When I search with a sentence, it only returns the exact match for the whole sentence, If I have search results that contains part of the sentence not the whole, they aren't returned. For example, if I search with "Dragon cars", the returned results must contains the whole query, the results that contains "Dragon" or "cars" are not returned.
-
Do you search in a RTE field? or Single Line? Is it Title or Display Name field?– Marek Musielak ♦Commented Oct 9, 2019 at 9:03
-
I'm searching at only single or multi line fields like Title or Description.– user6141Commented Oct 9, 2019 at 9:07
-
Does partial search work in multiline Description field?– Marek Musielak ♦Commented Oct 9, 2019 at 9:08
-
Yes it works well– user6141Commented Oct 9, 2019 at 9:12
1 Answer
If you are using SXA search renderings, then you are not exactly searching by Title or Description fields. The SXA search is using AggregatedContent computed field (sxacontent
in the index) and is using Contains
method on it like this:
predicate = predicate.And(i => i.AggregatedContent.Contains(t));
where t
is the text phrase, you are looking for.
The AggregatedContent will contain the text from Title and Description field so the Contains
should give you the results and I'm pretty sure it is working fine. But once again you are searching in the AggregatedContent filed, not Title or Description itself.
Take a look at the item fields and how it looks like in the index: