Hello,
Is lt compatible with Laravel Scout? https://laravel.com/docs/5.3/scout
Thanks for your responses.
I'll make a full functionality test tomorrow. However it should not have any major incompatibilities as _This library extends the original Laravel classes, so it uses exactly the same methods._
I've made a fast look at this library. And it seems to be working fine.
This class relies on this functions of $engine variable, which may be an instance of Moloquent. almost all of them are currently supported.
getpaginatePaginator::appendsPaginator::hasMorePagesWhenextend(EloquentBuilder $builder)Engines seem to be fine as they are fully abstracted.
AlgoliaEngine.php
Thank you very much for your analyse and looking forward for the next release :)
I鈥檓 having some problems in some specific cases that I still can exactly discover.
My Algolia index is not being updated every time I update a document in Mongo. Here is my issue https://github.com/jenssegers/laravel-mongodb/issues/1316
I clean my index in Algolia, I clean my collection in Mongo. I add 10000 documents and only 3000 gets indexed in Algolia.
Then I use ->searchable() to try to add all my documents, and it updates the 10000, not only the new 7000.
I don鈥檛 know if it鈥檚 normal or is related to Mongo
Hi all,
any news about compatibility with Laravel Scout? Does it works?
Hi @Surt
I had to extend the update method in Algolia Engine, and first I get actual document in Algolia and compare with mine, and I update in case it's needed.
The hard part is to compare a recursive Array.
You also have to ignore some fields when you compare.
_id doesn't exist in Algolia, so if you compare the documents, _id will be a difference.
Algolia charges for indexation, not for search. So in Update you first search, then compare, and update if needed.
That's how I fixed it
Thanks @elfeffe
I've actually succeed using https://github.com/jenssegers/laravel-mongodb with the elastic driver for scout https://github.com/babenkoivan/scout-elasticsearch-driver
I just needed to change the _id property so _id is converted to id
Now, it works like a charm. inserts, updates, deletes, etc...
Thank you very much @jenssegers for this awesome library.
/**
* Get the indexable data array for the model.
*
* @return array
*/
public function toSearchableArray()
{
$array = $this->toArray();
$array['id'] = $array['_id'];
unset($array['_id']);
return $array;
}
I made a simple solution
https://gist.github.com/elfeffe/54d4125447f0b7d65620a79a0efe165e
mongo already have a full-text search engine is there any chance to integrate scout with the mongo built in search instead of adding an extra layer es ?
Most helpful comment
I've made a fast look at this library. And it seems to be working fine.
Builder.php
This class relies on this functions of
$enginevariable, which may be an instance ofMoloquent. almost all of them are currently supported.getpaginatePaginator::appendsPaginator::hasMorePagesWhenSearchableScope.php
extend(EloquentBuilder $builder)Engines
Engines seem to be fine as they are fully abstracted.
AlgoliaEngine.php