Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/acs-content-repository/upgrade-4.5-4.6.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql,v diff -u -r1.4 -r1.4.4.1 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql 14 Sep 2001 04:53:02 -0000 1.4 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql 27 Sep 2002 15:32:49 -0000 1.4.4.1 @@ -74,34 +74,65 @@ -- triggers queue search interface to modify search index after content -- changes. +-- DaveB: We only want to index live_revisions 2002-09-26 + create function content_search__itrg () returns opaque as ' begin - perform search_observer__enqueue(new.revision_id,''INSERT''); +if (select live_revision from cr_items where item_id=new.item_id) = new.revision_id then + perform search_observer__enqueue(new.revision_id,''INSERT''); + end if; return new; end;' language 'plpgsql'; create function content_search__dtrg () returns opaque as ' begin - perform search_observer__enqueue(old.revision_id,''DELETE''); + select into v_live_revision live_revision from + cr_items where item_id=old.item_id; + if old.revision_id=v_live_revision then + perform search_observer__enqueue(old.revision_id,''DELETE''); + end if; return old; end;' language 'plpgsql'; create function content_search__utrg () returns opaque as ' +declare + v_live_revision integer; begin - insert into search_observer_queue ( - object_id, - event - ) values ( - old.revision_id, - ''UPDATE'' - ); + select into v_live_revision live_revision from + cr_items where item_id=old.revision_id; + if old.revision_id=v_live_revision then + insert into search_observer_queue ( + object_id, + event + ) values ( +old.revision_id, + ''UPDATE'' + ); + end if; return new; end;' language 'plpgsql'; +-- we need new triggers on cr_items to index when a live revision +-- changes -DaveB 2002-09-26 + +create function content_item_search__utrg () +returns opaque as ' +begin + if new.live_revision is not null and coalesce(old.live_revision,0) <> new.live_revision then + perform search_observer__enqueue(new.live_revision,''INSERT''); + end if; + + if old.live_revision is not null and old.live_revision <> coalesce(new.live_revision,0) then + perform search_observer__enqueue(old.live_revision,''DELETE''); + end if; + + return new; +end;' language 'plpgsql'; + create trigger content_search__itrg after insert on cr_revisions for each row execute procedure content_search__itrg (); @@ -111,6 +142,6 @@ create trigger content_search__utrg after update on cr_revisions for each row execute procedure content_search__utrg (); - - - +drop trigger content_item_search__utrg on cr_items; +create trigger content_item_search__utrg before update on cr_items +for each row execute procedure content_item_search__utrg ();