Android MATCH 后的 SQLite 附加 WHERE 条件
Android SQLite additional WHERE condition after MATCH
在 Android SQLite 中,我得到了这样的表格
domainObjectId: String // like '9876543210'
name: String
description: String
我想在此上使用 FTS 进行搜索而不用担心变音符号,但我想让用户 select 也通过键入对象 ID 的一部分(例如最后 4 个字符)
我 select 喜欢
`SELECT * FROM tabel LEFT JOIN tabel_fts on tabel_fts.domainObjectId = tabel.domainObjectId WHERE tabel_fts MATCH '3210*' OR tabel.domainObjectId LIKE '%3210%'
但是在 return 我得到错误
unable to use function MATCH in the requested context (code 1 SQLITE_ERROR);
是否可以使用 MATCH
向 select 添加附加条件?
尝试将 "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
顺便说一句:
- 在您的 "WHERE tabel_fts" 中,您似乎遗漏了一个列名称
- 表 JOINm 中没有 "ON" 条件,只有 "WHERE"。没关系?可能使用 UNION 会更好?
在 Android SQLite 中,我得到了这样的表格
domainObjectId: String // like '9876543210'
name: String
description: String
我想在此上使用 FTS 进行搜索而不用担心变音符号,但我想让用户 select 也通过键入对象 ID 的一部分(例如最后 4 个字符)
我 select 喜欢
`SELECT * FROM tabel LEFT JOIN tabel_fts on tabel_fts.domainObjectId = tabel.domainObjectId WHERE tabel_fts MATCH '3210*' OR tabel.domainObjectId LIKE '%3210%'
但是在 return 我得到错误
unable to use function MATCH in the requested context (code 1 SQLITE_ERROR);
是否可以使用 MATCH
向 select 添加附加条件?
尝试将 "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
顺便说一句:
- 在您的 "WHERE tabel_fts" 中,您似乎遗漏了一个列名称
- 表 JOINm 中没有 "ON" 条件,只有 "WHERE"。没关系?可能使用 UNION 会更好?