I have a website made in Laravel 5.2, and I need to implement a search box, I know what it basically the process involves (make petition to controller, find and then answer with json, etc).
So, before do that I really need to know some tips, what are best practices to achieve this in the best way as possible. Briefly, I have a database table with a lot of posts(really a lot, lets say 500k registers), every post have some properties: name, description, poster, punctuation. I know there's no a exactly answer to this question, but I only want to know what should I take in count before do that, how can I improve the search and how to make it using the best practices.
- 1.- Do you think that I need to create a separate table with only the
names
andid
of the post? this table is only for the search. - 2.- To make the search faster, should I put the
name
column as an index in the database? or sort by date? -
3.-How can I improve the speed of the search? maybe use some puntuation?(something based in how many times that post was the one searched by the user), it's a good idea?
-
4.- I'm thinking that maybe I only have to find by the name of the post because the quantity of items in the DB. Am I right?
-
5.- Also, which algorithms can I use to treat with some situations where the user wrote with a typo? I need to interpret what they tried to said and show them the related post.
-
6.- Which tools or extensions related do you recomend me?
Finally, thank you very much!
via Sredny M Casanova