Index: openacs-4/packages/search/search.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/search/search.info,v
diff -u -r1.16 -r1.17
--- openacs-4/packages/search/search.info 9 May 2004 15:33:14 -0000 1.16
+++ openacs-4/packages/search/search.info 14 May 2004 10:17:35 -0000 1.17
@@ -7,7 +7,7 @@
t
f
-
+
OpenACS
2004-04-18
Site wide search
@@ -17,7 +17,7 @@
Site wide search implemented with service contracts, currently
only supports postgres via the OpenFTS driver.
-
+
Index: openacs-4/packages/search/sql/postgresql/search-packages-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/search/sql/postgresql/search-packages-create.sql,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/search/sql/postgresql/search-packages-create.sql 17 May 2003 11:27:28 -0000 1.5
+++ openacs-4/packages/search/sql/postgresql/search-packages-create.sql 14 May 2004 10:17:35 -0000 1.6
@@ -1,8 +1,8 @@
+-- Search Observer Package
--
--- Search Observer
---
+-- @cvs-id $Id$
-create function search_observer__enqueue(integer,varchar)
+create or replace function search_observer__enqueue(integer,varchar)
returns integer as '
declare
p_object_id alias for $1;
@@ -20,8 +20,9 @@
end;' language 'plpgsql';
+select define_function_args('search_observer__enqueue','object_id,event');
-create function search_observer__dequeue(integer,timestamptz,varchar)
+create or replace function search_observer__dequeue(integer,timestamptz,varchar)
returns integer as '
declare
p_object_id alias for $1;
@@ -37,3 +38,6 @@
return 0;
end;' language 'plpgsql';
+
+select define_function_args('search_observer__dequeue','object_id,event_date,event');
+
Index: openacs-4/packages/search/sql/postgresql/upgrade/upgrade-5.2.0d1-5.2.0d2.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/search/sql/postgresql/upgrade/upgrade-5.2.0d1-5.2.0d2.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/search/sql/postgresql/upgrade/upgrade-5.2.0d1-5.2.0d2.sql 14 May 2004 10:17:36 -0000 1.1
@@ -0,0 +1,5 @@
+-- define args so we can package_exec_plsql
+-- JCD
+
+select define_function_args('search_observer__enqueue','object_id,event');
+select define_function_args('search_observer__dequeue','object_id,event_date,event');
Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/search/tcl/search-procs-oracle.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/search/tcl/search-procs-postgresql.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/search/tcl/search-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/search/tcl/search-procs.tcl,v
diff -u -r1.12 -r1.13
--- openacs-4/packages/search/tcl/search-procs.tcl 27 Apr 2004 12:09:18 -0000 1.12
+++ openacs-4/packages/search/tcl/search-procs.tcl 14 May 2004 10:17:36 -0000 1.13
@@ -7,6 +7,50 @@
namespace eval search {}
+ad_proc -public search::queue {
+ -object_id
+ -event
+} {
+ Add an object to the search_observer_queue table with
+ an event.
+
+ You should excercise care that the entry is not being
+ created from a trigger (although search is robust for multiple
+ entries so it will not insert or update the same object
+ more than once per sweep).
+
+ @param object_id acs_objects object_id
+ @param event INSERT or UPDATE or DELETE
+
+ @author Jeff Davis (davis@xarg.net)
+} {
+ package_exec_plsql \
+ -var_list [list \
+ [list object_id $object_id] \
+ [list event $event] ] \
+ search_observer enqueue
+}
+
+ad_proc -public search::dequeue {
+ -object_id
+ -event_date
+ -event
+} {
+ Remove an object from the search queue
+
+ @param object_id acs_objects object_id
+ @param event_date the event date as retrieved from the DB (and which should not be changed)
+ @param event INSERT or UPDATE or DELETE
+
+ @author Jeff Davis (davis@xarg.net)
+} {
+ package_exec_plsql \
+ -var_list [list [list object_id $object_id] \
+ [list event_date $event_date] \
+ [list event $event] ] \
+ search_observer dequeue
+}
+
ad_proc -private search::indexer {} {
Search indexer loops over the existing entries in the search_observer_queue
table and calls the appropriate driver functions to index, update, or
@@ -33,6 +77,7 @@
array set datasource [acs_sc_call FtsContentProvider datasource [list $object_id] $object_type]
search::content_get txt $datasource(content) $datasource(mime) $datasource(storage_type)
acs_sc_call FtsEngineDriver index [list $datasource(object_id) $txt $datasource(title) $datasource(keywords)] $driver
+ array unset datasource
}
# Remember seeing this object so we can avoid reindexing it later
set seen($object_id) 1
@@ -54,15 +99,15 @@
array set datasource [acs_sc_call FtsContentProvider datasource [list $object_id] $object_type]
search::content_get txt $datasource(content) $datasource(mime) $datasource(storage_type)
acs_sc_call FtsEngineDriver update_index [list $datasource(object_id) $txt $datasource(title) $datasource(keywords)] $driver
+ array unset datasource
}
# Remember seeing this object so we can avoid reindexing it later
set seen($object_id) 1
}
}
}
- db_exec_plsql search_observer_dequeue_entry {}
-
+ search::dequeue -object_id $object_id -event_date $event_date -event $event
}
}
@@ -84,6 +129,7 @@
set txt ""
+ # lob and file are not currently implemented
switch $storage_type {
text {
set data $content
@@ -110,16 +156,18 @@
upvar $_data data
switch -glob -- $mime {
- {text/plain*} {
+ {text/*} {
set txt $data
}
- {text/html*} {
- set txt $data
+ default {
+ error "invalid mime type in search::content_filter: $mime"
}
}
}
-ad_proc -private search::choice_bar { items links values {default ""} } {
+ad_proc -private search::choice_bar {
+ items links values {default ""}
+} {
@author Neophytos Demetriou
} {
Index: openacs-4/packages/search/tcl/search-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/search/tcl/search-procs.xql,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/search/tcl/search-procs.xql 27 Apr 2004 12:09:18 -0000 1.5
+++ openacs-4/packages/search/tcl/search-procs.xql 14 May 2004 10:17:36 -0000 1.6
@@ -2,6 +2,12 @@
+
+
+ insert into search_observer_queue (object_id, event_date, event) values (:object_id, now(), :event)
+
+
+
select object_id, event_date, event