1

I'm playing with notmuch-abook which uses sqlite3 to store names and email addresses. The sqlite table uses full text search, being created by:

CREATE VIRTUAL TABLE AddressBook USING fts4(Name, Address);

I have entries for myself with names "Hamish", "Hamish D" and "Hamish Downer". The query

select * from addressbook where addressbook match 'hamish';

Finds them all. However

select * from addressbook where addressbook match 'hamish d';

Finds only the entries with the exact name "Hamish D" but does not find the entries with name "Hamish Downer". I can get what I expect with:

select * from addressbook where name like 'hamish d%';

But I'd like to use the match version to match across both columns. Any idea what's going on here? Or how to get match to work as I want?

4

1 回答 1

5

阅读文档

查询

... addressbook match 'hamish d'

查找包含两个单词hamish和的记录d。您可能想要搜索该短语hamish d,您可以使用

... addressbook match '"hamish d"'

要搜索前缀,请使用*

... addressbook match '"hamish d*"'
于 2013-04-22T08:41:22.577 回答