Forum OpenACS Q&A: Problem and a doubt with the Search package.

Hi,

OpenACS newbie here.

I have installed dotLRN 2.3.0, Aolserver 4.5 and PostgreSQL 8.4.

I have the following problem and doubt with the Search Package:

PROBLEM:

I have installed the Search package and the Tsearch2 driver, and mounted the search package. If I go to http://My_server/admin/site-map/, I can see:

*************
URL INSTANCE PACKAGE TYPE
search Search Search
*************

The bindings for the FtsContentProvider and FtsEngineDriver service contracts are enabled. If I go to http://My_Server:8000/acs-service-contract, I can see:

*************
Valid Installed Bindings

IMPLEMENTATION NAME OWNER

content_revision acs-content-repository
image acs-content-repository
content_template acs-content-repository
file_storage_object file-storage
cal_item calendar
acs_event calendar
faq faq
faq_q_and_a faq
forums_forum forums
forums_message forums
news news
as_assessments assessment
pa_album photo-album
pa_photo photo-album

tsearch2-driver tsearch2-driver
*************

But, when I try to use the search package (at http://My_server/search) with the "estrategia" word (that appears in the FAQ inside of a question/answer), I obtain the following:

(1) The following error message:
"Error in include template /var/lib/aolserver/service0/packages/dotlrn/www/dotlrn-search": No script or template found for page '/var/lib/aolserver/service0/packages/dotlrn/www/dotlrn-search'"

(2) And next the message: "Your search - estrategia - did not match any content."

In the log entries appear:

**************
Error: Tcl exception:
Database operation "0or1row" failed
(exception NSINT, "Query returned more than one row.")

while executing
"ns_pg_bind 0or1row nsdb0 {
select package_id
from apm_packages
where package_key = :package_key
}"
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
("postgresql" arm line 2)
invoked from within
"switch $driverkey {
oracle {
return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
}
..."
invoked from within
"db_exec 0or1row $db $full_name $sql"
invoked from within
"set selection [db_exec 0or1row $db $full_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_name $sql]
}"
(procedure "db_string" line 27)
invoked from within
"db_string apm_package_id_from_key {
select package_id from apm_packages where package_key = :package_key
} -default 0"
(procedure "apm_package_id_from_key_mem" line 2)
invoked from within
"apm_package_id_from_key_mem search"
("eval" body line 1)
invoked from within
"eval $script"
invoked from within
"ns_cache eval util_memoize $script {
list $current_time [eval $script]
}"
(procedure "util_memoize" line 20)
invoked from within
"util_memoize "apm_package_id_from_key_mem $package_key""
(procedure "apm_package_id_from_key" line 2)
invoked from within
"apm_package_id_from_key search"
(procedure "search::indexer" line 3)
invoked from within
"search::indexer"
("eval" body line 1)
invoked from within
"eval [concat [list $proc] $args]"
(procedure "ad_run_scheduled_proc" line 46)
invoked from within
"ad_run_scheduled_proc {t f 60 search::indexer {} 1183466948 0 f}"

[03/Jul/2007:09:50:08][13516.2962897808][-sched:idle1-]
Notice: starting
[03/Jul/2007:09:50:17][13516.2994797456][-conn:2-] Error: Error in include template "/var/lib/aolserver/service0/packages/dotlrn/www/dotlrn-search": No script or template found for pa
ge '/var/lib/aolserver/service0/packages/dotlrn/www/dotlrn-search'
No script or template found for page '/var/lib/aolserver/service0/packages/dotlrn/www/dotlrn-search'
while executing
"error "No script or template found for page '$__adp_stub'""
invoked from within
"template::adp_parse [template::util::url_to_file "/packages/dotlrn/www/dotlrn-search" "$__adp_stub"] [list]"
*************

Do I need to do something more in order to have the search package running ok, and the content of the packages that implement FtsContentProvider service contract indexed (as for example populate manually the table: search_observer_queue).
I have restarted the services, but nothing at all.

DOUBT:

How can I mount a search package that only search the content of a specific package (for example de FAQ package)?

I think that a possible solution is uninstall all the FtsContentProvider service contract implementations, except the service contract implementation of the package that should be indexed (in the case of the example: the FAQ package). But these solution will disable those service contracts implementation for all the mounted search packages, then I won't be able to have a Wide Search Function (as an example).

Another possible solution is to limit the search to a subsite using the Search Package's parameter SubsiteSearchP ("If mounted in a subsite should the search be restricted to items in the subsite by default. Requires that package_id in acs_objects be properly populated."). But my doubt is about the scope of the "subsite", that is if in the subsite I have mounted the Forum and FAQ, then the search will be over the Forum and FAQ.

Is there a way to implement an specific search as in the case of the search over the Forum Package?.

I appreciate a lot your help!

Jorge.

Collapse
Posted by Jorge Couchet on
Well, regards the section PROBLEM:

A first problem is resolved following the post: https://openacs.org/forums/message-view?message_id=115449. These resolve the problem:

************
Error: Tcl exception:
Database operation "0or1row" failed
(exception NSINT, "Query returned more than one row.")
************

But, now I have a new problem:

************
Notice: dbdrv: opening database 'postgres:localhost::service0'
[03/Jul/2007:11:04:16][13954.2959178640][-sched:12-] Notice: Opening service0 on localhost
[03/Jul/2007:11:04:16][13954.2959178640][-sched:12-] Notice: Ns_PgOpenDb(postgres): Openned connection to localhost::service0.
[03/Jul/2007:11:04:33][13954.3036568464][-conn:0-] Notice: SEARCH search/www/search.tcl callback::datasource::forums_forum not found
[03/Jul/2007:11:04:33][13954.3036568464][-conn:0-] Warning: blank-compat: /var/lib/aolserver/service0/packages/search/www/search.adp uses deprecated property title instead of doc(titl
e).
[03/Jul/2007:11:04:33][13954.3036568464][-conn:0-] Warning: blank-compat: /var/lib/aolserver/service0/packages/search/www/search.adp uses deprecated property header_stuff instead of h
ead.
[03/Jul/2007:11:04:33][13954.3036568464][-conn:0-] Error: GET http://verarcis.selfip.org/search/search?q=Estrategia&t=Buscar
referred by "http://verarcis.selfip.org/search/";
callback search::url implementation file_storage_object does not exist
while executing
"error "callback $callback implementation $impl does not exist""
(procedure "callback" line 52)
invoked from within
"callback -impl $object_type search::url -object_id $object_id"
************

Perhaps the important there is: callback::datasource::forums_forum not found

Collapse
Posted by Emmanuelle Raffenne on
Hi Jorge,

I'm glad to see you around :).

Regarding the missing template dotlrn-search and the missing search::url callback implementation in file-storage, both have been fixed on the oacs-5-3 branch and those fixes will be included in the next release (dotlrn 2.3.1). You can update your local installation of file-storage and search from the repository using the oacs-5-3 tag.

Collapse
Posted by Jorge Couchet on
But the really strange is that:

1) If I go to acs-service-contract I can see the forums_forum implementation of FtsContentProvider is installed.

2) The word "Estrategia" is both in the Forum and in the FAQ. But if I try to search a word that is only in the FAQ, then I didn't recive the errors of:

************
a) Database operation "0or1row" failed
(exception NSINT, "Query returned more than one row.")

b) Notice: SEARCH search/www/search.tcl callback::datasource::forums_forum not found

************

But still I continue receiving the error of:

************
Error in include template "/var/lib/aolserver/service0/packages/dotlrn/www/dotlrn-search": No script or template found for page '/var/lib/aolserver/service0/packages/dotlrn/www/dotlrn-search'
************

And the word is not found:

************
Your search - learning - did not match any content.
************

Collapse
Posted by Jorge Couchet on
Hi Emmanuelle!

I'm around with some troubles 😊

Excellent! I'm doing that you suggest and reporting the advances.

Cheers

Jorge

Collapse
Posted by Jorge Couchet on
Hi Emmanuelle,

The actual versions of file-storage and search that I have are:

File Storage (FS): 5.3.0d1
Search: 5.3.1

Those versions are under the oacs-5-3 branch. If I try to upgrade through acs-admin/install/ (using "Upgrade from repository"), I have the message: "No packages on your system need upgrading." And if try to reload the package through the APM, I have the message: "There are no changed files to reload in this package.".

Under the oacs-5-4 branch, the FS version changes to 5.4.0d4 and the Search version didn't change. Is the 5.4.0d4 version of FS that I need to install?. If the answer is yes, which is the procedure for that?.

Cheers

Jorge

Collapse
Posted by Emmanuelle Raffenne on
Jorge,

I assume you installed from the 2.3.0 tarball. In this case, to upgrade from the repository:

- cd to your packages/ directory (/var/lib/aolserver/service0/packages?)
- remove file-storage/ and search/ directories
- from your packages/ directory, type:

cvs -d :pserver:mailto:anonymous@cvs.openacs.org:/cvsroot co -r oacs-5-3 search
cvs -d :pserver:mailto:anonymous@cvs.openacs.org:/cvsroot co -r oacs-5-3 file-storage
- restart your server
Collapse
Posted by Jorge Couchet on
Emmanuelle,

Excellent! Your instruction worked very well!!. Thanks a lot!

Only remains a problem:
I have searched the word "Estrategia" that is in the Forum and Faq, and the search brought me what is in Forum, but not that is in FAQ. It would seem to be that the Search Package isn't indexing the FAQ's content. Is there any extra trick in order to have the FAQ's content indexed?.

Cheers

Jorge.

Collapse
Posted by Jorge Couchet on
Well, I have inserted in the search_observer_queue the FAQ:

***************
insert into search_observer_queue ( select entry_id, current_timestamp, 'INSERT' from faq_q_and_as );
***************

And now the content of the FAQ is indexed. But if I put a new question with the word "estrategia" in the FAQ, the new question didn't appear in the search. It would seem to be that is failing the automatic indexing. Any clue for this?.

Collapse
Posted by Jorge Couchet on
Reading the document that states how to make an object searchable (in OpenACS documentation) appears the following:

**********
"if your object type uses the content repository to store its items, then you are done. If not, an extra step is required to inform the search_observer_queue of new content items, updates or deletions. We do this by adding triggers on the table that stores the content items of your object type"
**********

Isn't the FAQ package using the Content Repository and is necessary to add manually to the FAQ table the triggers to inform the search_observer_queue?.

Collapse
Posted by Emmanuelle Raffenne on
Jorge,

I don't think FAQ is using the content repository. The triggers to fill up the search_observer_queue table are missing in the FAQ package, that's why the content is not indexed.

Collapse
Posted by Jorge Couchet on
Emmanuelle,

Thanks a lot!! I'm adding the triggers to the FAQ Package!

Collapse
Posted by Jorge Couchet on
Ready! The content of the FAQ Package is now indexed automatically. For that I have added the following in the database:

******************

create function faq_sc__itrg ()
returns opaque as '
begin
perform search_observer__enqueue(new.entry_id,''INSERT''); return new;
end; ' language 'plpgsql';

create function faq_sc__dtrg ()
returns opaque as '
begin
perform search_observer__enqueue(old.entry_id,''DELETE''); return old;
end; ' language 'plpgsql';

create function faq_sc__utrg ()
returns opaque as '
begin
perform search_observer__enqueue(old.entry_id,''UPDATE''); return old;
end; ' language 'plpgsql';

create trigger faq_sc__itrg after insert on faq_q_and_as for each row execute procedure faq_sc__itrg ();

create trigger faq_sc__dtrg after delete on faq_q_and_as for each row execute procedure faq_sc__dtrg ();

create trigger faq_sc__utrg after update on faq_q_and_as for each row execute procedure faq_sc__utrg ();

******************

Thanks a lot for the help!

Jorge.

Collapse
Posted by Emmanuelle Raffenne on
Thanks Jorge. I've added the triggers to the repository at the oacs-5-3 branch.
Emmanuelle, you are welcome!!!