Skip to content

Use Algolia's filters parameter instead of numericFilters for string filter support#971

Closed
alecgarcia wants to merge 1 commit intolaravel:10.xfrom
alecgarcia:fix/algolia-wherenotin-string-filters
Closed

Use Algolia's filters parameter instead of numericFilters for string filter support#971
alecgarcia wants to merge 1 commit intolaravel:10.xfrom
alecgarcia:fix/algolia-wherenotin-string-filters

Conversation

@alecgarcia
Copy link

Summary

  • Migrates Algolia filter generation from the numericFilters parameter to the unified filters parameter, which supports both numeric comparisons and facet/string matching
  • Fixes string-based filters (e.g. whereNotIn('status', ['deleted'])) which previously failed because numericFilters only accepts numeric values
  • Uses proper Algolia filter syntax: key=value for numeric, key:"value" for strings, NOT key:"value" for string negation, (... OR ...) for whereIn groups, joined with AND
  • Adds comprehensive test coverage for string where/whereIn/whereNotIn, mixed numeric+string filters, quote escaping, floats, zero values, and single-value whereIn

Test plan

  • All existing Algolia v3 and v4 feature tests updated and passing
  • New tests added for: string where, string whereIn, string whereNotIn, single-value whereIn, quote escaping, float values, zero/soft-delete values, no-filter search
  • Full test suite passes (206 tests)
  • Verified filter string format against live Algolia API

Made with Cursor

…ter types

The numericFilters parameter only supports numeric values, causing string-based
filters (e.g. whereNotIn('status', ['deleted'])) to fail. This migrates all
filtering to the unified filters parameter, which supports both numeric
comparisons and facet/string matching using proper Algolia filter syntax.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alecgarcia alecgarcia marked this pull request as draft February 19, 2026 17:56
@alecgarcia alecgarcia marked this pull request as ready for review February 19, 2026 18:02
@taylorotwell
Copy link
Member

Hey there - I think it would be better to look at this on 11.x branch as where handling changed in that upcoming major version.

@alecgarcia
Copy link
Author

@taylorotwell I will look at the changes in 11.x but I should have mentioned I made this PR because PR #959 actually broke our scout setup not realizing our whereNotIn was not actually applying. We were passing in a string and when we did an update we started throwing exceptions. This PR was to get the wheres to actually match up with what the documentation shows in https://laravel.com/docs/12.x/scout#where-clauses

@alecgarcia
Copy link
Author

Looks like commits 81e699c and d8b1be5 on 11.x make similar changes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants