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.1 -r1.2 --- openacs-4/packages/search/tcl/search-procs.tcl 2 Sep 2001 18:11:39 -0000 1.1 +++ openacs-4/packages/search/tcl/search-procs.tcl 15 Sep 2001 21:31:50 -0000 1.2 @@ -14,7 +14,7 @@ INSERT { set object_type [db_exec_plsql get_object_type "select acs_object_util__get_object_type($object_id)"] array set datasource [acs_sc_call FtsContentProvider datasource [list $object_id] $object_type] - set txt [search_content_filter $datasource(content) $datasource(mime) $datasource(storage)] + 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 } DELETE { @@ -23,10 +23,8 @@ UPDATE { set object_type [db_exec_plsql get_object_type "select acs_object_util__get_object_type($object_id)"] array set datasource [acs_sc_call FtsContentProvider datasource [list $object_id] $object_type] - set txt [search_content_filter $datasource(content) $datasource(mime) $datasource(storage)] - if { $txt != "" } { - acs_sc_call FtsEngineDriver update_index [list $datasource(object_id) $txt $datasource(title) $datasource(keywords)] $driver - } + 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 } } @@ -41,61 +39,63 @@ } - -ad_proc search_content_filter { +ad_proc search_content_get { + _txt content mime - storage + storage_type } { @author Neophytos Demetriou + + @param content + holds the filename if storage_type=file + holds the text data if storage_type=text + holds the lob_id if storage_type=lob } { - switch $mime { - {text/plain} { - return $content + upvar $_txt txt + + switch $storage_type { + text { + set data $content } - {text/html} { - return $content + file { + set data [db_blob_get data "select $content, 'file' as storage_type"] } + lob { + set data [db_blob_get data "select $content, 'lob' as storage_type"] + } } - return + + search_content_filter txt data $mime + } -ad_proc search_content_get { - content + +ad_proc search_content_filter { + _txt + _data mime - storage } { @author Neophytos Demetriou - - @param content - holds the filename if storage=file - holds the text data if storage=text - holds the lob_id if storage=lob } { - switch $storage { - text { - return $content + upvar $_txt txt + upvar $_data data + + switch $mime { + {text/plain} { + set txt $data } - file { - if {[file exists $content]} { - set ofp [open $content r] - set txt [read $ofp] - close $ofp - } else { - error "file: $content doesn't exist" - } - return [DoubleApos $txt] + {text/html} { + set txt $data } - lob { - return $txt - } } - return } + + ad_proc search_choice_bar { items links values {default ""} } { @author Neophytos Demetriou } {