MySQL innoDB 关键字研究
问题:我有一个表格,其中包含与“标签”关联的“关键字”。 由于查询,我必须找到与输入字符串关联的标签。
示例:
DB (table):
keywords| label | weight
PLOP | ploplabel | 12
PLOP | ploplbl | 8
TOTO | totolabel | 4
... | ... | ...
输入字符串:“PLOP 123”
应返回:“ploplabel”
对于部分关键字研究,我脑海中的第一个本能查询是:
SELECT label FROM table WHERE keywords LIKE "%inputstring%" ORDER BY weight DESC
但正如您可能已经看到的,这与我想要的相反需要,类似:
SELECT label FROM table WHERE %keywords% LIKE "inputstring" ORDER BY weight DESC
我们可以在 MySQL 中做一些事情吗(innoDB === 无全文)?
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: "ploplabel"
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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 innodb 构建您的系统并创建一个 myisam 全文表以索引回您的 innodb 数据。这样您就可以获得 innodb 引擎的所有优点:聚集主键索引、行级锁定以及由一个或多个 myisam 表的全文功能补充的事务。
在 InnoDB 上实现类似全文搜索的任何方法
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