【发布时间】:2015-11-21 17:30:45
【问题描述】:
上下文
我有一个表指定为
CREATE VIRTUAL TABLE EmailAttachmentSearch USING
fts4(entityId Varchar(255), name, subject, type, group, from, json);
要求
我需要允许用户搜索name、subject、type、group 和from。
条件
我知道notindexed 选项,但由于多平台兼容性,我们仅限于不支持notindexed 的SQLite 3.7.4。
问题
我正在尝试构建一个等效于 MATCH 'word1* word2*' 但将排除 entityId 和 json 字段的查询。
我的尝试总是导致没有数据或数据过多。
无效示例
SELECT json
FROM EmailAttachmentSearch
WHERE EmailAttachmentSearch MATCH
'(name:word1*
OR type:word1*
OR subject:word1*
OR from:word1*)
AND (name:word2*
OR type:word2*
OR subject:word2*
OR from:word2*)'
【问题讨论】:
-
FTS 没有后缀搜索;您不能将
*放在搜索词的开头。 -
MATCH '"*word1* *word2*"'似乎有效? -
找到
xxxword1了吗? -
其实你是对的
-
知道如何做我要求的事情吗?
标签: sql sqlite full-text-search multiple-columns