MySQL/PHP fulltext search 1 word similarity -


I have a customer who wants to manage my SEO title / description for any page in the website, so I The module can enter the URL / TITLE / DESCRIPTION and the website will check the entry of that page, and if there is, show it.

I have tried to: $ url = 'http: //'.$_SERVER [' SERVER_NAME '] $ _ Server ['REQUEST_URI']; $ Q_seo = $ conexio-> Query (against "SELECT modulseo.titol, modulseo.descripcio, MATCH (modulseo.url))" (". $ Url.") As a module from the service, WHERE MATCH (modulseo.url) "' $ Url. '") By order DeSc serius 0,1';; if (mysql_num_rows ($ q_seo)) gt; 0) {$ d_seo = mysql_fetch_array ($ q_seo); $ headline = $ d_seo ['titol']; $ Descripcio = $ d_seo ['descripcio'];} and {$ titol = 'Default title'; $ Descripcio = 'Default description';}

This does not clearly work, Because I believe that the complete text search works only with a different word, not the similarity between 1 word and the other, as the client can enter in the backend URL:

  • < Code> http://www.domain.com/index.php
  • or http://domain.com/ Index.php
  • Or http://www.domain.com/index.php?language=fr
  • Or Http://domain.com/index.php?language=fr
  • etc ..

    And then the user of the website can access any

    Any clue about how to do this?

    Search with LIKE% varible% This is a slow query but it will work.

    Your table engine was to be mesed or if you can use InnoDB with a full text index of MySQL-V 5.6+

      mysql> Choose * from the exam; + ------ + ------ + ---------------------- + + | ID | Name | Last_name + ------ + ------ + ---------------------- + + | 0 | 0 | Http://domain.com/index.php | | 1 | 0 | Http://domain2.com/index.php | | 2 | 0 | Http://domain3.com/index.php | + ------ + ------ + ------------------------------ + 3 rows set In (0.00 seconds) mysql & gt; * Choose * from test where last_name like '% http: //domain.com/index.php%'; + ------ + ------ + ----------------------------- + | ID | Name | Last_name + ------ + ------ + ----------------------------- + | 0 | 0 | Http://domain.com/index.php | + ------ + ------ + ------------------------- 0.00% in + 1 set Seconds)    

Comments