Gravatar for

Question by benaldo, Mar 31, 2017 2:21 PM

Search with special characters


We're running into an issue with facets and searches that use special characters - specifically the plus sign.

When searching for galaxy s8+, both galaxy s8 and galaxy s8+ terms are matched. And in the facet, we only see the galaxys8+ term, even though inspecting further shows the term that is indexed is actually galaxys8.

I tried searching in the content browser in the admin tool on the box, and I'm seeing the same result. How do we go about getting both terms to show up? Is changing the '+' sign to the english equivalent ('plus') our only option?


1 Reply
Gravatar for

Answer by Daniel Lavoie, Mar 31, 2017 6:14 PM

Hi !

Unfortunately, the + sign is among characters that are considered to be non relevant when determining if two facet values are the same or not (almost every non alphanumeric characters are considered non relevant). This is why both s8 and s8+ map to the same facet value. The only way for both terms to show up would be to change the value at conversion time (post conversion script) to make the + something that would be considered relevant for comparison purposes, like 'plus' for example. I'm sorry that this behavior goes against the grain of what you are trying to accomplish.

From a UI perspective, I'm quite sure it would be possible to change the display back to what it should have been in the first place, using a label, but I'm not a UI expert.

Finally, the display value that is used, for facets having different initial values mapping to the same common value, is the one that was indexed last. So if you want to change a display value, you just need to update a document (or a post-conversion script), and re-index a single document sharing that display value.

Technicality: This display value is used by a facet structure that is typically rebuilt every day, at midnight, so if the display value does not change, you either need to wait until midnight (not fun), or have the facet structure rebuild itself. You can force a rebuild by adding a new field as a facet. You just need to remove it later if you don't need it. It is not optimal but for debugging purposes, it will let you test your display value fix easily.

Gravatar for

Comment by benaldo, Mar 31, 2017 6:44 PM

I like the idea of using a post conversion script to minimize impact on content authors. And you're right, we can address the UI after we get the facets working in a way that makes sense for our client.

Thank you for the thorough response!

Ask a question