Download the PHP package akkurateio/laravel-search without Composer
On this page you can find all versions of the php package akkurateio/laravel-search. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download akkurateio/laravel-search
More information about akkurateio/laravel-search
Files in akkurateio/laravel-search
Package laravel-search
Short Description Search package for Laravel applications
License AGPL-3.0-only
Informations about the package laravel-search
Laravel Search
This package provides a search engine for Akkurate Laravel Boilerplate.
By default, the search is performed on specific fields of the Eloquent model via the Spatie laravel-searchable package.
If this is insufficient for the needs of the project, this package allows to set up an indexing in Elasticsearch.
Installation
Publish the configuration file:
Publish views:
Publish the partial of the View component for Elasticsearch:
Publish entry views for the results page:
Eloquent
Configuration
In the laravel-search configuration file, declare the models to search and the fields to search on:
Elastic
Configuration
By default, the Elastic version is not active. In the app.js:
then
In the .env:
Add an observer in the config file
Create the observer
By default, the model is supposed to be in App\Models.
It is possible to change the path by providing a --namespace option. For example, if the model Example is in Package\Models:
Fill in the url schema to reach the resource (to generate the link that will appear when the resource goes up in the search results).
For example:
Add the declaration in the config file
index: should the model be indexed or not.
where: in the search:sync
command, if you don't want to send all the results to the Elastic database, it is possible to fill in a where clause, for example['status' => 'active']
.
route: the resource access schema, to generate the url when using the CLI.
key: the field defined to access the resource. By default 'id' if absent, but can be set to 'uuid' or 'slug', etc. as needed.
name: the model field used to fill the name field in Elastic.
suggest: on FALSE the entry goes directly up in the results; on TRUE the entry does not go up in the results but is used to bring up related results.
env: the environment in which the results are to be reported.
link: the view to which the links for this model will point ('edit' or 'show').
Entities
A function in the model allows to define and update the entities (relations to be indexed) for a given model.
Example: define an ACCOUNT entity on each USER. On the model App\Models\User :
CLI
Check the connection with akk4search
Display the list of observed models
Synchronize data with the ElasticSearch database
Test a keyword search
Generate a new observer
Delete data in the Elastic database
Removes all elastic data of the observed models (set to TRUE in the .env) + their SQL searchables
Removes all the elastic data related to the account (relative to the key filled in the .env) + their SQL searchables.
Removes all elastic data related to the doctype(s). Searchables must be deleted manually.
Removes all elastic data from the observed models and performs a synchronization.
All versions of laravel-search with dependencies
subvitaminetm/akkurate-for-search-sdk-php Version ^1.0