在Mysql全文搜索中,我搜索了一个短语" it department"在索引字段中。但它返回的结果包含单词department而不是" it department"。请指导我解决这个问题。
以下是我使用的语法,
从匹配(内容)的员工中选择*(" it department")
提前致谢
答案 0 :(得分:0)
MySQL FULLTEXT使用常用英语单词的停止列表。您最喜欢的单词@using (Html.BeginForm("IletisimForm", "SiteAnasayfa", FormMethod.Post, htmlAttributes: new { @class = "" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.TextBoxFor(model => model.Fullname, new { @class = "w-input easing" })
@Html.ValidationMessageFor(model => model.Fullname, "", new { @class = "text-danger text-bold" })
@Html.TextBoxFor(model => model.Telephone, new { @class = "w-input easing")
@Html.ValidationMessageFor(model => model.Telephone, "", new { @class = "text-danger text-bold" })
@Html.TextBoxFor(model => model.Email, new { @class = "w-input easing")
@Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger text-bold" })
@Html.TextAreaFor(model => model.Message, new { @class = "w-input easing" })
@Html.ValidationMessageFor(model => model.Message, "", new { @class = "text-danger text-bold" })
<input type="submit" class="fr w-button easing" value="Send" />
}
位于停止列表中。停止列表的目的是使索引大小合理。
如果您使用的是MySQL版本5.7+和InnoDB,则可以设置自己的停止列表。
这解释了如何。
https://dev.mysql.com/doc/refman/5.7/en/fulltext-stopwords.html
答案 1 :(得分:0)
你应该使用&#39;喜欢&#39;或者&#39; regexp&#39;代替
select * from employee where contents regexp'^it department$';
或
select * from employee where contents like 'it department';