P Kishor wrote: > > I would like to generate Snippets from MATCHes in two columns, > however, I get the following error: "unable to use function MATCH in > the requested context" with the following query -- > > SELECT poem_id, context > FROM poems a JOIN ( > SELECT > rowid, > Snippet(fts_poems, '<span class="hl">', '</span>', '…') > AS context > FROM fts_poems > WHERE poem MATCH ? OR history MATCH ? > ) b ON a.poem_id = b.rowid >
Does this work for you? SELECT poem_id, context FROM poems as a JOIN ( SELECT rowid, Snippet(fts_poems, '<span class="hl">', '</span>', '…') AS context FROM fts_poems WHERE rowid in ( select rowid from fts_poems where poem MATCH ? union select rowid from fts_poems where history MATCH ? ) ) as b ON a.poem_id = b.rowid; It runs each match in a separate subquery and doesn't generate an error when prepared by sqlite. HTH Dennis Cote _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users