Package Data | |
---|---|
Maintainer Username: | babenkoivan |
Maintainer Contact: | babenko.i.a@gmail.com (Ivan Babenko) |
Package Create Date: | 2020-02-15 |
Package Last Update: | 2024-09-27 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-10 15:01:33 |
Package Statistics | |
---|---|
Total Downloads: | 1,646,622 |
Monthly Downloads: | 49,135 |
Daily Downloads: | 296 |
Total Stars: | 266 |
Total Watchers: | 7 |
Total Forks: | 52 |
Total Open Issues: | 0 |
Extension for Elastic Scout Driver.
Elastic Scout Driver Plus supports:
The current version of Elastic Scout Driver Plus has been tested with the following configuration:
The library can be installed via Composer:
composer require babenkoivan/elastic-scout-driver-plus
Note, that the library doesn't work without Elastic Scout Driver. If it's not installed yet, please follow the installation steps described here. If you are already using Elastic Scout Driver, I recommend you to update it before installing Elastic Scout Driver Plus:
composer update babenkoivan/elastic-scout-driver
If you want to use Elastic Scout Driver Plus with Lumen framework refer to this guide.
Elastic Scout Driver Plus comes with a new trait, which you need to add in your model to activate advanced search functionality:
class Book extends Model
{
use Searchable;
use CustomSearch;
}
This trait adds a bunch of factory methods in your model: boolSearch()
, matchSearch()
, rawSearch()
, etc.
Each method creates a search request builder for the specific query type. For example, if you want to make a
match query use matchSearch()
method:
$searchResult = Book::matchSearch()
->field('title')
->query('My book')
->fuzziness('AUTO')
->size(10)
->execute();
Choose factory method depending on the query type you wish to perform:
If there is no method for the query type you need, you can use rawSearch()
:
$searchResult = Book::rawSearch()
->query(['match' => ['title' => 'The Book']])
->execute();
It is important to know, that all search request builders share the same generic methods, which provide such basic functionality as sorting, highlighting, etc. Check the full list of available generic methods and the usage examples here.
Finally, refer to this page to get familiar with $searchResult
object, pagination and more.