On Fri, Apr 12, 2013 at 9:28 AM, Lukas Gebauer <[email protected]> wrote:

> I have contentless FTS4 index for searching some my external data
> paired by docid.
>
> What I can do, when my existing previously indexed document was
> changed? I need to update existing FTS4 index too. But documentation
> says: "UPDATE and DELETE is not supported".
>
> Can I do new INSERT with existing docid again? Or what I can do else?
>

I am not familiar with how the contentless fts indices work, but in general
when fts2/3/4 delete a row, the index terms are removed by re-parsing the
original content, then inserting deletion tokens, which later "catch up"
with the originals and overwrite them.  Update is delete+insert, so has the
same restrictions.  In the best case, inserting again would insert all of
the new terms without removing the now-missing terms.  There are other ways
it could have been coded, but that's the way it was coded.

If this functionality is very important in general, you could perhaps have
an auxiliary table which records logical presence of rows, and only match
rows which exist in both tables.  Then you can delete from that table to
prevent rows from the fts index from matching.  Updates would effectively
be "delete marker row from aux table, insert the document as a new row". If
you need a stable identifier, the aux table can provide that bridge, too.

With such a solution, if you have lots of churn you may wish to
periodically re-create the entire index.

-scott
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to