Laravel Search Engine

I am creating a REST api using Laravel for a mobile application. And now I need a search engine.

First off, I have never used a search engine. So I'm looking for one that just works, but is still good at full-text search and "where" filtering

In the table in which I want to perform a search, there is 1 column (varchar45), which should be a full-text search, and then there are 5 columns (int) that are used for filtering using the "where" operator. - Using mysql approach. I also do an inner join on this table to print some other things when creating the result.

So, I looked at sphinx and Elasticsearch , and decided to go with ES .

I watched the ES entry from Laracon: https://www.youtube.com/watch?v=waTWeJeFp4A

and I also reviewed this package: https://github.com/freekmurze/searchindex

This left me with a few questions:

1) Do I render a mysql database and store ALL my data in ES?

2) If 1 is yes, can I use my mysql DB and just use ES to store indexes? - Since I need to perform a search on only one table (the search consists of 5 rows).

3 If 2-yes, am I still storing the current indexes in my mysql table? For example, the full text in the header column, FK in another column and the index on 3 others.

4 Since this is the first time I've ever used a search engine, is there another tutorial / book / snippet where you can use ES with Laravel ?

Thank you in advance

+6
source share
1 answer

I recently solved the same problems. My opinion:

1. no. definitely keep your database for data storage. ES was not created to replace your database. it is (mainly) a search engine.

4. you can find a good tutorial here: http://www.fullstackstanley.com/read/simple-search-with-laravel-and-elasticsearch (as a starting point).
I suggest you also read http://www.elasticsearch.org/guide/en/elasticsearch/guide/ (better understand ES)

+8
source

Source: https://habr.com/ru/post/981968/


All Articles