I have the following tables

CREATE TABLE poems (poem_id, poem, history);

CREATE VIRTUAL TABLE fts_poems USING fts3 (poem, history);

INSERT INTO fts_poems (rowid, poem, history)
SELECT poem_id, poem, history FROM poems;

The following works --

SELECT poem_id, context
FROM poems a JOIN (
        SELECT
                rowid,
                Snippet(fts_poems, '<span class="hl">', '</span>', '&hellip;') 
AS context
        FROM fts_poems
        WHERE poem MATCH ?
) b ON a.poem_id = b.rowid


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>', '&hellip;') 
AS context
        FROM fts_poems
        WHERE poem MATCH ? OR history MATCH ?
) b ON a.poem_id = b.rowid

The Snippet query syntax seems wrong and awkward to me because the
Snippet function requires the table name rather than the more
intuitive (to me) column name on which the MATCH is being done. What
am I doing wrong?

-- 
Puneet Kishor
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to