Skip to content

Easy fix: search only works with ASCII characters #491

Description

@piskov

Ruby’s \w is basically [a-zA-Z0-9_] which is useless for many languages.

Thus the following code ↓ inside searchable.rb means search won’t work for extended latin, greek, cyrillic, what have you

        def remove_invalid_search_characters(terms)
          terms.gsub(/[^\w"]/, " ") // ***********************←
        end

        def quote_query_tokens(terms)
          terms.scan(/"[^"]*"|\w+/) // ***********************←
            .filter_map { |token| token.delete('"').presence }
            .map { |token| %("#{token}") }
            .join(" ")
        end

Replace it with [[:word:]] and this should fix it according to the benevolent AI (I don’t know shit about RoR)

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions