0

I can't search with any special character in the default search block form or in search API. Commonly used word like B&W (black and white) don't seem indexed up well, probably due to some encoding or decoding problem.

screenshot

0

Drupal's built-in search, as well as Search API, generally search full words. Using Search API, you can further configure the search to match parts of words and consistently ignore special characters in the matching process (as some may reserve other purposes like logical AND / OR).

Based on your use case/example,

  • check the minimum character length for search suggestions (it is usually three) (but since it strips away special characters such as the &, your search criteria is only two characters), and
  • enable the "Ignore characters" processor and configure it to ignore the ampersand symbol, hyphens, or any others consistently in both the form submission and the search index results as suggested here in this Search API issue post: Special characters are always ignored in searches on DB backend

Additional references:

  1. Review all the configurable Search API processors to ensure you are indexing your content appropriately: https://www.drupal.org/docs/8/modules/search-api/getting-started/processors

  2. Check out this succinct blog post "How to set up search API for partial words in Drupal" that provides a checklist for configuring your Search Index.

  3. Consider configuring a search view that reflects a "Single phrase" parse mode to find exact matches with special characters. This Using Search API, Search API Solr and Facets in Drupal 8 slidedeck provides a good rundown of caveats with Search API for D8.

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.