Mariusz
Mariusz

Reputation: 1410

Android SQLite additional WHERE condition after MATCH

In Android SQLite i got tabel like this

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

I want to use FTS on this to search without worrying about diacritical marks, how ever i want to let user select also by typing part of object ID(ex. last 4 char)

I got select like

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

But in return i get error

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

Is this possible to add additional condition to select with MATCH?

Upvotes: 0

Views: 147

Answers (1)

sergiy tykhonov
sergiy tykhonov

Reputation: 5103

Try to remove "MATCH" into separate "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

By the way:

  1. In your "WHERE tabel_fts" it seemed you've missed a column name
  2. There is no "ON" condition in tables JOINm just "WHERE". That's OK? May be it would be better to use UNION?

Upvotes: 1

Related Questions