lazar / elastic
elasticsearch for news portals
Requires
- php: ^7.2|^8.0
- babenkoivan/elastic-client: ^1.2|^2.1
- http-interop/http-factory-guzzle: ^1.0
This package is not auto-updated.
Last update: 2025-02-06 09:33:31 UTC
README
Installation:
If Front and CMS are separate projects, the installation procedure is as follows.
- composer require lazar/elastic (on both projects)
- php artisan vendor:publish --tag=config --provider="News\Elasticsearch\ElasticsearchServiceProvider" (on both projects)
- Set up config/elasticsearch.php (on both projects)
- php artisan vendor:publish --tag=controller --provider="News\Elasticsearch\ElasticsearchServiceProvider" (front)
- php artisan vendor:publish --tag=commands --provider="News\Elasticsearch\ElasticsearchServiceProvider" (cms)
CMS
The console command to create the index is run manually. The console command for updating the index is started with the help of ArticleObserver, so that it "listens" to what is happening with the article. Depending on whether it is created, updated or deleted, it will start the corresponding method. In the config file, the "run_observer" key is set to "true" to enable the index to be updated. Also, if you want to enable search by tag, you can do so by setting the key "include_tags_in_search" to "true" in the config file.
Front
Adjust the config file depending on the config file from the CMS. Customize the view blade based on the data you get from the controller.