algolia / algoliasearch-rails

AlgoliaSearch integration to your favorite ORM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option for sanitize to whitelist specific characters

wahlg opened this issue · comments

  • Rails version: 4.2.7.1
  • Algolia Rails integration version: 1.15.1
  • Algolia Client Version: 1.11.0
  • Language Version: 2.3.8

Description

Would it be possible to add more features for attribute sanitization, or to allow a custom sanitizer to be passed in? Right now it looks like the only supported option is sanitize: true which performs full HTML sanitization on all attributes:

::HTML::FullSanitizer.new

Specifically, I'm interested in the ability to whitelist the & character since it is getting indexed as & in Algolia when included in a string attribute.

Steps To Reproduce

Add sanitize: true to the list of options passed to algoliasearch. Create an attribute that has an ampersand:

  attribute :some_attribute do
    'This & That'
  end

Index the record and see it shows up as This & That