#community-help

NumericFilter Adjustment for Search Adapter in GitHub

TLDR Jordan discovered a potential issue in the numericFilter for a search adapter in GitHub. After discussing with Jason, a fix using an updated Regex formula was found and Jordan agreed to submit a PR.

Powered by Struct AI

1

4
17mo
Solved
Join the chat
May 20, 2022 (17 months ago)
Jordan
Photo of md5-ad648f0416b0aa480b934e45bcc719ee
Jordan
05:50 PM
I made a comment about it in GitHub, but just wanted to check in here. Does the numericFilter for the search adapter need to account for = in its RegEx? I think it's missing and can make a PR, but just wanted to check before moving forward (referring to here)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
08:53 PM
Jordan Good catch. It looks like Algolia uses = for equality, and I thought it used : for equality for some reason.

This is the updated that Regex that works for all the cases I tested:

(.*?)(<=|>=|>|<|:|=)(.*)

I'd appreciate a PR!
08:54
Jason
08:54 PM
(needed to add an extra non-greedy matcher ? in the beginning to get it to work as expected)
Jordan
Photo of md5-ad648f0416b0aa480b934e45bcc719ee
Jordan
08:55 PM
Jason awesome! Thanks for confirming and for sharing the correct version, I'll submit a PR for this later today

1