Explanation of this package #148
-
Hi, Out of curiosity i would like to ask how does this package and driver for scout work. Imagine my scenario for a bit. We have an eshop where the main product model has like 10 other relationships - color, size, size table, material composition etc. On the product show page it loads everything with releationships resulting in rougly 30 sql queries. So i was thinking if i create a fake product model and store it in elastic with column such as product name, color ,size etc when i would query a specific product from elastic it would make 0 sql queres in dream scenario. However I understand that this package allows me 'only' to store product model with it's relationships in an index, query against it, use power of elastic for matching, score based on points etc and then query the eloquent models based on the ids that elastic returns. So in the end it results in the same 30 sql queries I 'just' get better search in results and more advanced document oriented search engine. Is that correct please? Because i have header of companies which use elastic as main storage for for example proucts but i dont think it's the best idea. Please explain me more I would really like to grasp the knwoledge how this is supposed to be done in real life. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This package is a driver for Laravel Scout and Scout indeed only improves your search results. So you are correct. That is purely how Laravel Scout works. Elastic Search can be used instead of those 30 SQL queries. I have done so in the past. If you want that you can still use this package I think without Scout. The underlying repositories and adapters should be able work for you (or you use the Elastic PHP SDK directly). You will need to write more logic yourself in the end to save entire models to Elastic documents and build your search results page around it. |
Beta Was this translation helpful? Give feedback.
This package is a driver for Laravel Scout and Scout indeed only improves your search results. So you are correct.
That is purely how Laravel Scout works. Elastic Search can be used instead of those 30 SQL queries. I have done so in the past. If you want that you can still use this package I think without Scout. The underlying repositories and adapters should be able work for you (or you use the Elastic PHP SDK directly). You will need to write more logic yourself in the end to save entire models to Elastic documents and build your search results page around it.