Enhancing string matching with transliteration

Created on 31 October 2024, 15 days ago

Problem/Motivation

When using the views_json_source module to query JSON APIs, I encountered an issue with string matching when the strings contain accented or special characters. For example, a search for "prévoyance" does not return results if the string in the JSON is "prevoyance". This is due to the lack of transliteration handling in string comparisons, which prevents matching similar strings with different accents or special characters.

Steps to reproduce

1. Use the views_json_source module to query a JSON API.
2. Ensure the JSON data contains strings with accented or special characters (e.g., "prevoyance").
3. Perform a search using a string with different accents or special characters (e.g., "prévoyance").
4. Observe that the search does not return the expected results due to the lack of transliteration handling.

Proposed resolution

To address this issue, I added transliteration handling to the views_json_source module. The following changes were made:

Modification of the ViewsJsonQuery class to handle transliteration:
- Added a transliterateValue method to transliterate values before comparing them.
- Modified the ops method to use transliteration during string comparisons.

Remaining tasks

- Review the changes to ensure they meet the module's standards.
- Test the changes in various scenarios to confirm that transliteration handling works as expected.
- Update the documentation to reflect the new transliteration handling feature.

User interface changes

No user interface changes are required. The transliteration handling is automatically applied during string comparisons in JSON queries.

API changes

No API changes are required. The transliteration handling is integrated into the existing methods of the ViewsJsonQuery class.

Data model changes

No data model changes are required. The transliteration handling does not affect the data structure or storage.

Feature request
Status

Downport

Version

2.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024