开发者

Keyword researchs in innoDB MySQL

I never post in forums as there are always the answer somewhere... but I really can't find this one (maybe I don't look at the problem the good way).

Problem: I have a table containing "keywords" associated to a "label". I have to find the label associated to an input string thanks to a query.

Example:

DB (table):
keywords| label     | weight
PLOP    | ploplabel | 12
PLOP    | ploplbl   | 8
TOTO    | totolabel | 4
...     | ...       | ...

Input string : "PLOP 123"

Should return: "pl开发者_如何学JAVAoplabel"

The first instinctive query in my mind, for partial keywords reasearch, was :

SELECT label FROM table WHERE keywords LIKE "%inputstring%" ORDER BY weight DESC

But as you may have seen, it is the opposite I would need - something like :

SELECT label FROM table WHERE %keywords% LIKE "inputstring" ORDER BY weight DESC

Is it something we can do in MySQL (innoDB === no fulltext) ?

Thank you guys

Cheers


Build your system using innodb and create a myisam fulltext table to index back into your innodb data. That way you get all the advantages of the innodb engine: clustered primary key indexes, row level locking and transactions supplemented by the fulltext capabilities of one or more myisam tables.

Any way to achieve fulltext-like search on InnoDB

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜