lunar
lunar copied to clipboard
Improve non-Scout searching
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
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 |
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
No longer required, fixed via Filament update.