No results for search term containing ampersand

Created on 12 June 2019, over 5 years ago
Updated 2 September 2019, over 5 years ago

I'm getting no results for a search term containing an ampersand like "H&M" despite having multiple indexed nodes with titles that contain the same string. I'm sure this is something I can cater for via a processor (Tokenizer?) but I'm unsure about how to go about it. I'm using the regular "Database Search" backend rather than Solr etc. Can anyone give me a pointer here?

🐛 Bug report
Status

Needs work

Version

1.0

Component

Database backend

Created by

🇬🇧United Kingdom dddbbb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • I have the same issue. Terms like "R&R" are treated as "R R" thus search api searches and highlights all the letters. It should however treat R&R as one word. Can't figure this out, I tried the \W and disabled certain processors, however I can't get it to work, it keeps searching and highlighting the letter R.

  • 🇺🇸United States rishi kulshreshtha

    @drunken, when searching for values without the "&" symbol, I'm getting results, but including "&" isn't returning the expected one. I’m wondering if this issue is related to the database component or if it’s actually a problem with the Search API since I’m encountering it while using the Search API with Solr.

  • 🇦🇹Austria drunken monkey Vienna, Austria

    @rishi kulshreshtha: I think most people want their searches to ignore the & character, so I wouldn’t be surprised if the default Solr configuration provided by the Solr module did ignore them. However, the beauty of Solr is that everything is configurable, so you just need to adapt your configuration to have it index & characters exactly the way you want. (Though reading up on Solr configuration takes a while at first, of course. Here (or the version corresponding to your Solr version) is a good place to start, I think, if you are basically familiar with what Solr does.)

    So, to answer your question: This issue is just about the database backend, but it probably also exists with other backends. It’s not a problem of the Search API framework itself, though, as that makes no assumptions about what constitutes words/tokens.

Production build 0.71.5 2024