Forum OpenACS Development: fs::add_file Versus callback search::datasource

Hi there,

Adding files, using fs::add_file (externally from file-storage), returns an error related to the callback proc: [search::datasource].

It seems "dbqd.file-storage.tcl.file-storage-callback-procs.callback::search::datasource::impl::file_storage_object.fs_datasource" has been missing somehow, but the error only happens when I use [fs::add_file] externally from file-storage package (i.e. not within file-stoage pkg)

Plus, datasources are present in the datamodel

It's seems because fs::add_file has been used outside file-storage pkg, the callback missed dbqd's location.

How would I make the callback aware of dbqd location (i.e. path "dbqd.file-storage.tcl.file-storage-callback-procs.callback::search::datasource) ?

Context. datasources are present in the datamodel and error.log is pasted bellow.

Best wishes,

 revision_id | item_id | title | description |         publish_date          |        mime_type         | nls_language | lob |    content     | content_length
-------------+---------+-------+-------------+-------------------------------+--------------------------+--------------+-----+----------------+----------------
       43854 |   43853 |       |             | 2018-05-03 14:25:26.480492-03 | application/octet-stream |              |     | /43/85/3/43854 |        5633259
(1 row)

item_id | parent_id | name | locale | live_revision | latest_revision | publish_status | content_type | storage_type | storage_area_key | tree_sortkey | max_child_sortkey ---------+-----------+----------+--------+---------------+-----------------+----------------+---------------------+--------------+------------------+------------------------------------------------------------------------------------------+------------------- 43853 | 43817 | campanha | | 43854 | 43854 | ready | file_storage_object | file | CR_FILES | 1000000000000000000000111110010010000000000000000000001110000100000000010001101000000100 | (

[03/May/2018:14:25:26][1808.b40f8b40][-conn:evex:0:249-] Warning: Replaced sTaRt/eNd magic tags in ad_text_to_html [03/May/2018:14:25:50][1808.a2effb40][-sched:10-] Error: search::indexer: error getting datasource for 43854 file_storage_object: No fullquery for dbqd.file-storage.tcl.file-storage-callback-procs.callback::search::datasource::impl::file_storage_object.fs_datasource and default SQL empty - query for statement missing No fullquery for dbqd.file-storage.tcl.file-storage-callback-procs.callback::search::datasource::impl::file_storage_object.fs_datasource and default SQL empty - query for statement missing while executing "error "No fullquery for $statement_name and default SQL empty - query for statement missing"" (procedure "db_qd_replace_sql" line 10) invoked from within "db_qd_replace_sql $statement_name $pre_sql" (procedure "db_exec" line 13) invoked from within "db_exec 0or1row $db $full_statement_name $sql" ("uplevel" body line 2) invoked from within "uplevel 1 $code_block " invoked from within "db_with_handle -dbn $dbn db { set selection [db_exec 0or1row $db $full_statement_name $sql] }" (procedure "::nsf::procs::db_0or1row" line 48) invoked from within "db_0or1row fs_datasource {} -column_array datasource" (procedure "::callback::search::datasource::impl::file_storage_object" line 4) invoked from within "::callback::search::datasource::impl::file_storage_object -object_id 43854" ("uplevel" body line 1) invoked from within "::uplevel 1 [::list $procname {*}$args]" invoked from within "callback -impl $object_type search::datasource -object_id $object_id" invoked from within search::indexer invoked from within ad_run_scheduled_proc {{t f 31 search::indexer {} 1525360476 0 f}}

[03/May/2018:14:25:50][1808.a2effb40][-sched:10-] Error: search::indexer: error getting datasource for 43854 file_storage_object: No fullquery for dbqd.file-storage.tcl.file-storage-callback-procs.callback::search::datasource::impl::file_storage_object.fs_datasource and default SQL empty - query for statement missing No fullquery for dbqd.file-storage.tcl.file-storage-callback-procs.callback::search::datasource::impl::file_storage_object.fs_datasource and default SQL empty - query for statement missing while executing "error "No fullquery for $statement_name and default SQL empty - query for statement missing"" (procedure "db_qd_replace_sql" line 10) invoked from within "db_qd_replace_sql $statement_name $pre_sql" (procedure "db_exec" line 13) invoked from within "db_exec 0or1row $db $full_statement_name $sql" ("uplevel" body line 2) invoked from within "uplevel 1 $code_block " invoked from within "db_with_handle -dbn $dbn db { set selection [db_exec 0or1row $db $full_statement_name $sql] }" (procedure "::nsf::procs::db_0or1row" line 48) invoked from within "db_0or1row fs_datasource {} -column_array datasource" (procedure "::callback::search::datasource::impl::file_storage_object" line 4) invoked from within "::callback::search::datasource::impl::file_storage_object -object_id 43854" ("uplevel" body line 1) invoked from within "::uplevel 1 [::list $procname {*}$args]" invoked from within "callback -impl $object_type search::datasource -object_id $object_id" invoked from within search::indexer invoked from within ad_run_scheduled_proc {{t f 31 search::indexer {} 1525360476 0 f}}

Collapse
Posted by Iuri Sampaio on
So far, debugging the callback call I've found the following info. The script fails in the line 52. As expected, the script is unable to find the correspondent query.

File file-storage-callback-procs.tcl Line 52

ad_proc -public -callback search::datasource -impl file_storage_object {} {
...

db_0or1row fs_datasource {} -column_array datasource

...

However, the query is there and works fine, when used directly in the file-storage pkg.

<fullquery name="fs_datasource">

select r.revision_id as object_id, i.name as title, (case i.storage_type when 'lob' then r.lob::text when 'file' then '[cr_fs_path]' || r.content else r.content end) as content, r.mime_type as mime, '' as keywords, i.storage_type as storage_type from cr_items i, cr_revisions r where r.item_id = i.item_id and r.revision_id = 43854

Furthermore, the datasource exists. Meaning, the execution of fs::add_file seems ti be working just fine.

object_id | title | content | mime | keywords | storage_type
-----------+----------+----------------------------+--------------------------+----------+--------------
43854 | campanha | [cr_fs_path]/43/85/3/43854 | application/octet-stream | | file
(1 row)

How would I make the callback aware of "No fullquery for dbqd.file-storage.tcl.file-storage-callback-procs.callback::search::datasource::impl::file_storage_object.fs_datasource" when fs::add_file is declared outside file-stroage package?

What is the fundamental concept, which I don't understand here?

Best wishes,