with t_title as ( select 'aaabbbdddf ' title_name from dual union all select 'aaabbb ' from dual union all select 'aaabbbbddd' from dual) select * from t_title where round(length('aaabbbddd')/length(title_name),1)>=0.8 and round(length('aaabbbddd')/length(title_name),1)<1 and title_name like '%aaabbbddd%' 试试 'aaabbbddd'是你新标题 结果: TITLE_NAME aaabbbdddf
在这个字段上建个全文索引,然后根据score来查。
and title_name like '%aaabbbddd%' 这不就是内容???? 内容匹配 并且占原来的80% 仔细看看,和运行下
表:t_title,列:title_name(标题)
该表数据如下:
abcdefg1111
aaabbbccc
abcdefghij
eeeeeee
badeffff
abcdefgg如果用户输入标题为abcdefgh的数据,就会把abcdefghij这条记录列出来,因为我要的结果是匹配80%的数据
还有一种是关键字匹配,
你要根据字数相同在80%以上?
( select 'aaabbbdddf ' title_name from dual
union all
select 'aaabbb ' from dual
union all
select 'aaabbbbddd' from dual)
select * from t_title
where round(length('aaabbbddd')/length(title_name),1)>=0.8
and round(length('aaabbbddd')/length(title_name),1)<1
and title_name like '%aaabbbddd%'
试试
'aaabbbddd'是你新标题
结果:
TITLE_NAME
aaabbbdddf
在这个字段上建个全文索引,然后根据score来查。
这不就是内容????
内容匹配 并且占原来的80%
仔细看看,和运行下
哎,当个思路参考下吧。
全文检索相关资料:
http://epub.itpub.net/4/1.htm
就你这个例子来说
abcdefg1111
aaabbbccc
abcdefghij
eeeeeee
badeffff
abcdefgg 如果用户输入标题为abcdefgh的数据,就会把abcdefghij这条记录列出来是否要查询出的记录要完全包含abcdefgh这个字符串,然后abcdefgh长度占该记录总长度 的80%以上?abcdefg匹配吗,defghabc匹配吗