Hello.
I've always got great help in this list so I thank in advance who posts here and who will answer to my question.

I've started to use FTS in a web site for search thru a table of sites.
Given a main table containing, among others, fields "id", "url", "nome" (title) and "descrizione" (description), I keep the fts table updated in this way:

CREATE TRIGGER "upd_sito"
AFTER UPDATE
ON "siti"
BEGIN
UPDATE fts3_siti
SET nome=new.nome, url=new.url, descrizione=new.descrizione
WHERE docid=new.id;
END;

CREATE TRIGGER "del_sito"
AFTER DELETE
ON "siti"
BEGIN
DELETE FROM fts3_siti WHERE docid=old.id;
END;

CREATE TRIGGER "ins_sito"
AFTER INSERT
ON "siti"
BEGIN
INSERT INTO fts3_siti(docid,nome,url,descrizione)
VALUES(new.id,new.nome,new.url,new.descrizione);
END;

The FTS virtual table is defined as:

CREATE VIRTUAL TABLE "fts3_siti" USING fts3 (
    nome TEXT,
    url TEXT,
    descrizione TEXT);

I use fts3 since my host doesn't yet offer PHP 5.3.8 which contains a SQLite version that includes FTS4.

Before extending this feature to other sections of the site I need to know if this is an efficient way to keep the FTS table updated.

Also, is there any pragma or so to tell FTS to automatically search for parts of words, instead of requiring users to add *?

As said, thanks for any help and sorry for my bad english.



--
Saluti da Gabriele Favrin
http://www.favrin.net
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to