Download the PHP package chr15k/laravel-meilisearch-advanced-query without Composer
On this page you can find all versions of the php package chr15k/laravel-meilisearch-advanced-query. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chr15k/laravel-meilisearch-advanced-query
More information about chr15k/laravel-meilisearch-advanced-query
Files in chr15k/laravel-meilisearch-advanced-query
Package laravel-meilisearch-advanced-query
Short Description Laravel Meilisearch advanced query generator
License MIT
Informations about the package laravel-meilisearch-advanced-query
Laravel Meilisearch Advanced Query
This library provides an intuitive query builder that makes generating more complex Meilisearch queries (compound, nested, meilisearch specific operators, ranking etc.) easier, replacing the need to construct your own raw Meilisearch queries when working with Scout's advanced filter option. Check out the Usage section below :)
[!NOTE] This package assumes you have installed and setup the following:
Install
Usage
For context, go here to see how custom search engine queries are typically used with Laravel Scout.
[!NOTE] The following example effectively replaces the standard
User::search($term, $callback)
method and will return a Scout Builder instance after callingsearch()
as expected:
Builder Methods
where(column, operator(optional), value(optional), boolean(optional))
orWhere(column, operator(optional), value(optional))
whereIn(column, value(optional))
orWhereIn(column, value(optional))
whereNotIn(column, value(optional))
orWhereNotIn(column, value(optional))
whereNot(column, value(optional))
orWhereNot(column, value(optional))
whereIsEmpty(column)
orWhereIsEmpty(column)
whereTo(column, from, to)
orWhereTo(column, from, to)
whereRaw(rawQuery)
orWhereRaw(rawQuery)
whereExists(column)
orWhereExists(column)
whereIsNull(column)
orWhereIsNull(column)
Nested / grouped queries
Sorting
In addition to the above methods, you can also call sort on the builder instance as follows:
Single column sort:
Multiple column sort:
For more information on sorting see this link
Supported search engine operators
Docs: Meilisearch operators
Alternatively to the methods above, any of these operators can be called on where()
or orWhere()
methods, example:
Calling without operator will default to equals (same behaviour as Eloquent):
Debugging / helpers
To get the raw query string from the builder, call compile()
instead of search()
To inspect the current builder instance properties:
Or use the dump
helper:
Tests
All versions of laravel-meilisearch-advanced-query with dependencies
http-interop/http-factory-guzzle Version ^1.2
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
laravel/scout Version ^8.0|^9.0|^10.0
meilisearch/meilisearch-php Version ^1.11