FTS sqlite短语搜索无法单列 [英] FTS sqlite phrase search for single column not possible

查看:49
本文介绍了FTS sqlite短语搜索无法单列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用sqlite的FTS扩展名,似乎无法弄清楚如何在短语中搜索一列,而将其他文本与其他文本进行匹配.通常,短语搜索适用于所有列,例如:

i've been using the FTS extension of sqlite, and can't seem to figure out how to do a phrase search for one column while matching some other text for some other. Usually doing a phrase search works for ALL columns like:

SELECT * from ftstable where ftstable MATCH '"Phrase With Spaces In It"';

以及具有以下内容的特定列:

and for a specific column with:

SELECT * from ftstable where body MATCH '"Phrase With Spaces In It"';

但不适用于以下两列中的汇总搜索:

but doesn't work for a aggregated search in two columns like:

SELECT * from ftstable where ftstable MATCH 'body:"Phrase With Spaces In It" title:"The*"';

并抛出:

Error: malformed MATCH expression: [body:"Phrase With Spaces In It" title:"The*"]

我发现此线程声称不可能(2011年11月): http://osdir.com/ml/sqlite-users/2011-11/msg00363.html .有人知道现在是否有可能吗?

I found this thread claiming it is not possible (November 2011) : http://osdir.com/ml/sqlite-users/2011-11/msg00363.html . Does anyone know if this is possible now ?

我只能想象使用'INTERSECT'的解决方法,但是问题是,导致相交的两个结果集太大,查询将变得非常慢并且内存效率低下,特别是因为我将其部署在移动设备上.

I can only imagine a workaround using an 'INTERSECT' but the problem is then the resulting two sets that get intersected are too big and the query will be much slower and memory inefficient, especially since i deploy this on a mobile device.

谢谢.

推荐答案

您是否尝试过:

SELECT * FROM ftstable WHERE (ftstable MATCH 'body:"phrase with spaces in it"') AND (ftstable MATCH 'title:The*')

这篇关于FTS sqlite短语搜索无法单列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆