Forum OpenACS Development: OpenFTS: Enable Search for package

I learned the hard way that you have to execute the -sc-create.sql script to enable a package to make use of OpenFTS (at least it is true for Blogger and ETP).

Wouldn't it make more sense, to have an admin page where you could enable and disable a package to be included in the search.

What I was thinking is: The statements needed to get FTS to work are located in -fts-create.sql files. Upon startup FTS (if installed) checks all packages for -fts-create.sql files. Furthermore it checks if the package has been enabled for search (we could add a quick table package_type, enabled_p for this). A list of all possible packages will be displayed, with an enable and disable link attached to it. Disable would execute the -fts-drop.sql. It will screw around in the ACS-SC, but not in a way that does too much harm ;).

Optimal solution would be to have an "enable FTS" link on a per package instance on the site-map. But this is daydreaming for the future, unless someone is willing to fund this (as I assume this is a *major* undertaking).

Collapse
Posted by Iuri Sampaio on
HI Malte,

great idea on creating an admin page for that issue.
Is that really hard to implemented?

I ran the sql script
$psql -f search-sc-create.sql

and i got error of duplicated id:

*************************8

psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:8: NOTICE: adding missing FROM-clause entry for table "acs_object_id_seq"
CONTEXT: PL/pgSQL function "acs_object__new" line 17 at select into variables
PL/pgSQL function "acs_sc_contract__new" line 7 at assignment
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:8: ERROR: duplicate key violates unique constraint "acs_sc_contracts_name_un"
CONTEXT: PL/pgSQL function "acs_sc_contract__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:14: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:18: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
acs_sc_operation__new
-----------------------
1019
(1 row)

psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:34: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:38: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
acs_sc_operation__new
-----------------------
1022
(1 row)

psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:54: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:58: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
acs_sc_operation__new
-----------------------
1025
(1 row)

psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:74: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:78: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
acs_sc_operation__new
-----------------------
1028
(1 row)

psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:94: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:98: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
acs_sc_operation__new
-----------------------
1031
(1 row)

psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:113: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:117: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
acs_sc_operation__new
-----------------------
1034
(1 row)

psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:136: ERROR: duplicate key violates unique constraint "acs_sc_contracts_name_un"
CONTEXT: PL/pgSQL function "acs_sc_contract__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:141: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:145: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
acs_sc_operation__new
-----------------------
1038
(1 row)

psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:161: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
psql:conaje/packages/search/sql/postgresql/search-sc-create.sql:165: ERROR: duplicate key violates unique constraint "acs_sc_msg_types_name_un"
CONTEXT: PL/pgSQL function "acs_sc_msg_type__new" line 19 at SQL statement
acs_sc_operation__new
-----------------------
1041
(1 row)

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

How do i enable search package?

Collapse
Posted by Iuri Sampaio on
So far,
I found a very good thread on oacs website
http://209.162.194.125/forums/message-view?message_id=89360

I can;t find AOLserver nsfts module to download and install it.

neither at debian pkgs
http://packages.debian.org/cgi-bin/search_packages.pl?keywords=aolserver&searchon=names&subword=1&version=stable&release=all

Plus, there's another thread:
https://openacs.org/forums/message-view?message_id=164980

which takes you to a OpenFTS Installation Tutorial
http://www.thedesignexperience.org/openacs/openfts-031

I've downliaded Search-OpenFTS-0.39 but i got stuck. There's no cofigure file to run

./configure --with-tcl=/usr/lib/tcl8.4 --with-aolserver-src=../aolserver4/

any clue?

Collapse
Posted by Malte Sussdorff on
You do not need FTS driver with latest versions of OpenACS and Postgres. Look for tsearch2, which is what our search package supports.
Collapse
Posted by Iuri Sampaio on
Thanks Dave,

following the tutorial everything ended up well.
posqtgresql-contrib installation, sql upload script and tsearch2-driver pkg installation

I missed only the enable part, i'll decide later what packages i should add.

is it also a search for members? I can't test it isn't enable yet.

That would be great. Then I don't need to create a specific one or even adapt the one oacs has in the users-administration module.

Collapse
Posted by Christian Brechbuehler on
Long ago, Malte suggested:
Wouldn't it make more sense, to have an admin page where you could enable and disable a package to be included in the search.

Good suggestion, what's the progress? It seems the administration is now kind of covered by the page /acs-service-contract/ -- the installed bindings for FtsContentProvider determine what's searchable. There can be more than one impl per package; e.g., bug-tracker gives you bt-bug and bt-patch.

What I still miss is automatic indexing. Sure, I can type

insert into search_observer_queue
(select bug_id, creation_date, 'INSERT' from bt_bugs);
to get all bugs indexed. And in theory it should only be necessary once. But it doesn't feel elegant. Maybe a after-bind callback could do it for me. Is there such a mechanism in acs-service-contract?

(Worse, I also have to manually insert a single bug_id for UPDATE after commenting on a bug, but this may be a misconfiguration on my setup.)