Android SQLite 在 MATCH 之后附加 WHERE 条件



在Android SQLite中,我得到了这样的表格

domainObjectId: String // like '9876543210'
name: String
description: String

我想在此上使用 FTS 进行搜索而不必担心变音符号,我多么想让用户也通过键入对象 ID 的一部分(例如最后 4 个字符(进行选择

我选择了喜欢

`SELECT * FROM tabel LEFT JOIN tabel_fts on tabel_fts.domainObjectId = tabel.domainObjectId WHERE tabel_fts MATCH '3210*' OR tabel.domainObjectId LIKE '%3210%'

但作为回报,我得到错误

unable to use function MATCH in the requested context (code 1 SQLITE_ERROR);

是否可以添加其他条件以MATCH选择?

尝试将"MATCH"删除为单独的"SELECT":

`SELECT * FROM tabel LEFT JOIN (select * from tabel_fts WHERE tabel_fts.domainObjectId MATCH '3210*') as tabel_fts WHERE tabel.domainObjectId LIKE '%3210%' OR table_fts.ID IS   NOT NULL

顺便一提:

  1. 在您的"WHERE tabel_fts"中,您似乎错过了一个列名称
  2. 表中没有"ON"条件,只有"WHERE"。没关系?也许使用联盟会更好?

最新更新