1
我有一个FTS3表像这样的比赛:sqlite的重量全文搜索
CREATE VIRTUAL TABLE docs USING fts3(id, title, body);
我想要使体重在标题的比赛比在内容,如this question
我做什么更高:
SELECT
case when title match 'word' then 1 else 0 end as titleRank,
case when body match 'word' then 1 else 0 end as contentRank
docs.*
FROM docs
WHERE title match 'word' OR body match 'word'
ORDER BY titleRank desc, contentRank desc
但似乎select case
不全文搜索(我用this tool工作,没有错误,没有从该查询响应,但如果我删除select case
,它的工作原理)
我在哪里错了?
1.你的'id'列将被全文索引; [这不是关键](http://www.sqlite.org/fts3.html#section_1_3)。 2.参见[matchinfo函数](http://www.sqlite.org/fts3.html#matchinfo)。 –
@CL。抱歉,我不明白matchinfo如何解决我的问题。你能解释一下吗? – R4j
它可以返回有关哪个词出现在哪个列中的信息。 –