0

I am not able to use more than one match functions in filter() of Query where single match() working fine but when i start to use more than two match() it gives error like

assertion failed: unable to use function MATCH in the requested context: file /Users/rspl/Desktop/Tests/SqliteSwiftDemo/SqliteSwiftDemo/SQLiteSwift/Statement.swift, line 196

following example creates a problem:

emails.filter(  match("xyz", body) && match("wonder*", body))

is there any other alternate available ? or i made mistake.

I just want two simultaneous match from same or different columns.

Jasmin
  • 794
  • 7
  • 18

2 Answers2

0

FTS only allows one 'MATCH' per SELECT statement. You can try this

emails.filter(match("xyz", body)).filter(match("wonder*", body))
ielyamani
  • 17,807
  • 10
  • 55
  • 90
  • this gives the same error message as above i have described. I think this statement give same as i have denoted in example(question) – Jasmin Jun 16 '15 at 11:14
  • 1
    Check out http://www.sqlite.org/fts3.html#section_3_1 — If you want to MATCH on multiple things, you just need to use `AND`, `OR`, or separate by a space. It's like searching on Google or other search engines. My suggestion: `emails.filter(match("xyz AND wonder*", body))`. – stephencelis Jun 16 '15 at 21:07
0

You can use only one MATCH in a Select statement, But you can use the following to achieve this,

SELECT * FROM fts_table WHERE fts_table MATCH 'A:XXX OR B:YYY' assuming that A,B are column names

diyoda_
  • 5,274
  • 8
  • 57
  • 89