MATCH之后的Android SQLite附加WHERE条件

问题描述 投票:0回答:1

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

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

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

我有喜欢的选择

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

但是作为回报,我得到了错误

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

是否可以添加附加条件以通过MATCH选择?

android sqlite full-text-search android-room
1个回答
0
投票

尝试将“ 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. 表JOINm中没有“ ON”条件,只是“ WHERE”。没关系?也许使用UNION会更好?
© www.soinside.com 2019 - 2024. All rights reserved.