How to do the search for mysql
-
There's a challenge-- contextual search on key words in mysql database. We need a solution to find any match inside the title of the article.
SELECT * FROM articles a WHERE $sql AND (MATCH(a.title) AGAINST ({search}) OR a.title LIKE '%слово%'
If you use a solution that makes it possible to use a full-text search, the problem is, what doesn't work if there's, like, a database. Vasyapukin I''ll be in the search-- Vasyapu
-
LIKE's "%text%" because of the first percent causes a full scan of all the lines, don't use it roughly ever.
A beautiful and direct method will be using SphinxSearch, Apache Solr, Lucene, but it requires the installation and construction of an additional sophth on the server (this is actually worth)
Make a request to the species:
SELECT * from articles a WHERE $sql AND MATCH(a.title) AGAINST (In BOOLEAN MODE) )
And next to the search form, finish the brief. http://dev.mysql.com/doc/refman/5.7/en/fulltext-boolean.html :
"the word" is just looking.
"+word" is mandatory
"word" doesn't necessarily include
"words" is a partial search.