#### Category : algolia

The following is my environment: Laravel version 8.6.0 PHP 7.3.22 Algolia Search API Client for PHP 2.7.0 Laravel Scout 8.3.1 My plan is to use the automatic updating and saving feature when I implement Use Searchable. I have placed the function to import the selected fields in the toSearchArray public function toSearchableArray() { if($this->Active==1){$array[‘objectID’] ..

Since Laravel Scout doesn’t support more complex where clauses than simple numeric comparisons. I checked the source code and I found the following lines if (!empty($models =$model->getScoutModelsByIds($builder,$modelKeys))) { $instances =$instances->merge($models->load($searchable->getRelations($modelClass))); } The instances is what is returned from Algolia search, so for example the following search essentially returns the$instances variable. Mode::search(‘something’)->get(); ..

I’m using the scout extended because i have multiple models in one index ( i’m using aggregators ) The aggregator is class AllPosts extends Aggregator { /** * The names of the models that should be aggregated. * * @var string[] */ protected $models = [ ‘AppThread’, ‘AppReply’, ‘AppProfilePost’, ]; protected$relations = [ ProfilePost::class ..

I have two models i.e. Project and Task A task belongs to a project And i use Algolia in Project model class Project extends Model { use Searchable; public function tasks() { return $this->hasMany(Task::class); } public function addTask($body, $userId = null) { return$this->tasks()->create([‘body’ => $body, ‘completed’ => false, ‘user_id’ =>$userId ? $userId : .. Read more I have a Laravel 7 app that uses Spatie’s tagging package, and also Algolia search using their standard library via its stock Laravel Scout integration. The two search mechanisms come down to this for the tags:$items = Item::withAllTags( \$searchtags, Item::TAGTYPE_PRIMARY ); This apparently returns an Eloquent "scope", not a builder or collection, which I ..