Index: openacs-4/packages/acs-content-repository/acs-content-repository.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/acs-content-repository.info,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-content-repository/acs-content-repository.info 29 Aug 2001 21:22:48 -0000 1.9 +++ openacs-4/packages/acs-content-repository/acs-content-repository.info 8 Sep 2001 15:20:11 -0000 1.10 @@ -139,7 +139,7 @@ + - Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql,v diff -u -r1.20 -r1.21 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql 29 Aug 2001 05:12:50 -0000 1.20 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql 8 Sep 2001 15:20:11 -0000 1.21 @@ -1099,9 +1099,8 @@ -- prompt *** Creating object types... \i types-create.sql --- DC@: oracle-specific code that can't be directly ported to postgresql. -- prompt *** Preparing search indices... --- \i content-search.sql +\i content-search.sql -- this index requires prefs created in content-search -- create index cr_doc_filter_index on cr_doc_filter ( content ) 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.2 -r1.3 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql 7 Sep 2001 23:48:47 -0000 1.2 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-search.sql 8 Sep 2001 15:20:11 -0000 1.3 @@ -5,21 +5,21 @@ select acs_sc_impl__new( 'FtsContentProvider', -- impl_contract_name - 'acs-content-repository', -- impl_name - 'acs-content-repositorys' -- impl_owner_name + 'content_revision', -- impl_name + 'acs-content-repository' -- impl_owner_name ); select acs_sc_impl_alias__new( 'FtsContentProvider', -- impl_contract_name - 'acs-content-repository', -- impl_name + 'content_revision', -- impl_name 'datasource', -- impl_operation_name 'content_search__datasource', -- impl_alias 'TCL' -- impl_pl ); select acs_sc_impl_alias__new( 'FtsContentProvider', -- impl_contract_name - 'acs-content-repository', -- impl_name + 'content_revision', -- impl_name 'url', -- impl_operation_name 'content_search__url', -- impl_alias 'TCL' -- impl_pl Index: openacs-4/packages/acs-content-repository/tcl/search-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/search-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/tcl/search-procs.tcl 8 Sep 2001 15:20:11 -0000 1.1 @@ -0,0 +1,72 @@ +ad_proc content_search__datasource { + object_id +} { + Provides data source for search interface. Used to access content items + after search. +} { + db_0or1row notes_datasource { + select r.revision_id as object_id, + r.title as title, + r.content as content, + r.lob as lob, + r.mime_type as mime, + '' as keywords, + i.storage_type as storage + from cr_revisions r, cr_items i + where revision_id = :object_id + and i.item_id = r.item_id + } -column_array datasource + + switch $datasource(storage) { + lob { + db_with_handle db { + set datasource(content) [ns_pg blob_get $db $datasource(lob)] + } + } + + file { + set fh [open [cr_fs_path]/$content r] + fconfigure $fh -translation binary + set datasource(content) [read $fh] + close $fh + } + } + + return [array get datasource] +} + + +ad_proc content_search__url { + object_id +} { + Provides a url for linking to content items which show up in a search + result set. +} { + + set package_id [apm_package_id_from_key acs-content-repository] + db_1row get_url_stub " + select site_node__url(node_id) || + (select content_item__get_path(item_id,null) + from cr_revisions + where revision_id = :object_id) as url + from site_nodes n + where n.object_id = :package_id + " + + return $url +} + +ad_proc content_search__search_ids { + q + { offset 0 } + { limit 100 } +} { + Returns the object ids for a specified search. +} { + + set package_id [apm_package_id_from_key search] + set driver [ad_parameter -package_id $package_id FtsEngineDriver] + array set result [acs_sc_call FtsEngineDriver search [list $q $offset $limit] $driver] + + return $result(ids) +}