EF或原生sql语句使用全文索引

EF用contains 或 自己构建SQL

EF.Functions.Contains

EF.Functions.FreeText

 

低版本EF:

https://www.cnblogs.com/chsword/p/ef_fts.html 

https://github.com/fissoft/Fissoft.EntityFramework.Fts

 

原生sql语句使用全文索引:

Contains

例如,下面语句检索Book表的Title列和Notes列中包含“database”或“computer”字符串的图书名称及其注释信息: 
select title, notes
from book
where contains(tilte, ‘database’) or contains(notes,‘database’)
or contains(title,‘computer’) or contains(notes,‘computer’)

freetext

例如,下面语句使用FREETEXT语句搜索Book表中包含“Successful Life”字符串的数据行: 
select title, notes
from book
where freetext(*,‘Successful Life’)
posted @ 2022-06-22 11:42  毛毛虫!  阅读(148)  评论(0编辑  收藏  举报