lunar icon indicating copy to clipboard operation
lunar copied to clipboard

Improve non-Scout searching

Open glennjacobs opened this issue 9 months ago • 2 comments

Fixes https://github.com/lunarphp/lunar/issues/2094

Currently, searching in the admin panel without Laravel Scout enabled isn't working 100%.

This PR aims to solve that by allowing a case insensitive search on JSON fields. To achieve this we introduce a builder macro to enhance Laravel's query builder.

  • [x] Relation fields
  • [x] Global search
  • [x] Table search
  • [ ] Document changing scout default to false

glennjacobs avatar Mar 18 '25 14:03 glennjacobs

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 8, 2025 7:13am

vercel[bot] avatar Mar 18 '25 14:03 vercel[bot]

Currently this doesn't appear to work properly for multiple paths. For example:

Product::query()->whereJsonContainsInsensitive('attribute_data', ['name', 'description'], 'value')->toRawSql()

Yields the following query in MySQL

select * from "lunar_products" where LOWER(json_unquote(json_extract(attribute_data, '$."name"'))) LIKE '%value%' and LOWER(json_unquote(json_extract(attribute_data, '$."name"."description"'))) LIKE '%value%' and "lunar_products"."deleted_at" is null

alecritson avatar Apr 01 '25 10:04 alecritson

No longer required, fixed via Filament update.

glennjacobs avatar Aug 14 '25 13:08 glennjacobs