There is a base of videos, each of which has a name consisting of several words. Base on 6 million records. At the entrance receive search queries (also consisting of several words). It is necessary for these requests to select from the database the most relevant video recordings. The main criterion is the speed of work. What methods have I tried:
I split each search query into an array of words and made mysql queries of the form:
select * from videos where title LIKE "%слово1%" AND title LIKE "%слово2%" AND title LIKE "%слово3%"
If nothing was found, then removed some “words” from the query and executed it again. It worked very slowly.
I took out all the records from the database and went through them in a cycle, inside which I broke words into each search query, and checked what proportion of the total number of words was in the name of the video. If the coefficient of occurrences of more than 0.7, then recorded this video in the result for this search query. The way works too slowly.
I ask you to suggest a solution in which there will be a good speed of work (I consider a good speed a sample of 30,000 videos for 10-20 minutes on an average PC).