SQL全文搜索查询? [英] SQL Full Text Search Query?
问题描述
我试图在登录表上执行全文搜索,并且当我执行相应的查询时,以下是我的观察结果:
i am trying to implement a full text search on a login table and when i am executing the respective query then following are my observations:
当我执行在执行全文搜索的查询之后,它可以读取近似 1665行
When i am executing the following query implementing the full text search it is able to fetch approximate 1665 rows
select * from t_user where contains(LOGIN_ID, '"*david*" )
但在执行类似查询时不使用完整使用下面的文本搜索它返回 1872行
but when implementing the similar query without using full text search using the following it is returning 1872 rows
select * from T_USER where LOGIN_ID like '%david%'
当我浏览时将数据扔到我的表格中,我得出结论:当我使用contains关键字忽略了像 DDAVID_D 这样的具有登录标识的行,或者我可以说它只返回具有像 DAVID_FRANK 这样的大写单词分隔的行。
As i browsed throw the data in my table i came to a conclusion that when i am using the contains keyword it is neglecting the row which has login id like DDAVID_D or i may say it is only returning rows which have the david words separated like DAVID_FRANK.
有没有一种搜索方法ha之间的单词(如在DDavidFrank之间搜索David,或者我可能会在DDAVIDFRANK中为大卫字符串搜索长连续词),以便有效地实现全文搜索?
Is there a way to search a word between the words (like searching for David in between DDavidFrank or i may searching between long continous words for the david string like in DDAVIDFRANK ) as to implement full text search effectively ?
推荐答案
试试
WHERE FREETEXT(LOGIN_ID, 'david') OR CONTAINS(LOGIN_ID, 'david')"
这篇关于SQL全文搜索查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!