gpt4 book ai didi

mysql - innoDB MySQL 中的关键字研究

转载 作者:行者123 更新时间:2023-11-30 23:38:39 24 4
gpt4 key购买 nike

问题:我有一个包含与“标签”关联的“关键字”的表格。由于查询,我必须找到与输入字符串关联的标签。

示例:

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 === 没有全文)?

最佳答案

使用 innodb 构建您的系统并创建一个 myisam 全文表以索引回您的 innodb 数据。这样您就可以获得 innodb 引擎的所有优势:聚簇主键索引、行级锁定和由一个或多个 myisam 表的全文功能补充的事务。

Any way to achieve fulltext-like search on InnoDB

关于mysql - innoDB MySQL 中的关键字研究,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5310104/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com