Forum OpenACS Q&A: Response to Example Service Contract for bboard (Search/OpenFTS)

If you want to index items that were added the the bboards before you set up search, you need to manually insert them into the queue. Write a pl/pgsql function to do search_observer__enqueue(object_id, 'INSERT') for every bboard object you want indexed. Here is an example I wrote for forums:
create function enqueue_forums() returns int as
'
declare v_message_row record;
begin
for v_message_row in
        select message_id from forums_messages
        where forum_id in
        (select forum_id from forums_forums
                where enabled_p=''t'')
loop
        perform search_observer__enqueue(v_message_row.message_id,''INSERT'');
end loop;

return 0;
end;' language 'plpgsql';