Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Create both an INSERT and an UPDATE trigger for search.

  • Loading branch information...
commit 3375c8cf6ff427fd66f723b798bb84750fa26b99 1 parent 32a1a76
@ato ato authored
Showing with 16 additions and 1 deletion.
  1. +16 −1 clojars.sql
View
17 clojars.sql
@@ -43,7 +43,7 @@ create virtual table search using fts3
jar_name text not null,
group_name text not null);
-create trigger update_search insert on jars
+create trigger insert_search insert on jars
begin
delete from search where jar_name = new.jar_name and group_name = new.group_name;
insert into search (id, jar_name, group_name, content) values
@@ -55,3 +55,18 @@ create trigger update_search insert on jars
new.user || ' ' ||
coalesce(new.description, ''));
end;
+
+create trigger update_search update on jars
+ begin
+ delete from search where jar_name = new.jar_name and group_name = new.group_name;
+ insert into search (id, jar_name, group_name, content) values
+ (new.id, new.jar_name, new.group_name,
+ new.jar_name || ' ' ||
+ new.group_name || ' ' ||
+ new.version || ' ' ||
+ coalesce(new.authors, '') || ' ' ||
+ new.user || ' ' ||
+ coalesce(new.description, ''));
+ end;
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.