1. Go to this page and download the library: Download shader2k/search-indexer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shader2k / search-indexer example snippets
$searchIndexer = new SearchIndexerService(new ProviderManager(), new DriverManager());
//переиндексация всей модели
$searchIndexer->indexingModel(User::class);
//переиндексация одной сущности
$index = $searchIndexer->indexingEntity($entity);
//удаление одной сущности
$index = $searchIndexer->removeEntity($entity);
$this->app->singleton('SearchIndexerService', function ($app) {
return new SearchIndexerService(new ProviderManager(), new DriverManager());
});
$indexerService = App::make('SearchIndexerService');
//переиндексация всей модели
$indexerService->indexingModel(User::class);
//переиндексация одной сущности
$index = $indexerService->indexingEntity($entity);
//удаление одной сущности
$index = $indexerService->removeEntity($entity);