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’] ..

Read more

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(); ..

Read more

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