Forum OpenACS Q&A: bboard search working out-of-the-box in OpenACS 3.2.5?

Is bboard module's full-text-search supposed to work out-of-the-box
in OpenACS 3.2.5?
You have to set UseOpenACSSearch to one in the parameters file.
If you install from RPMs and install the postgresql-tcl RPM too, then the bboard search is automatically enabled for you.

If you need to install 'by hand', then you have to change that param Don mentioned, and do

  su - postgres -c "createlang pltcl yourdbname"
  psql -q -U yourdbuser yourdbname </web/yourservername/www/doc/sql/rank-for-search.sql

too. Adjust the values of yourdbname, yourdbuser, and yourservername to match your own installation of course!

Jonathan - That's what I hadn't done -- full-text-search is now working. Thanks Don and Jonathan.
Hi, I am trying to add the bboard search feature and thus far this is the message I get upon doing a search:
HTTP/1.0 500 Internal Server Error MIME-Version: 1.0 Date: Thu, 30 Aug 2001 17:49:33 GMT Server: AOLserver/3.4 Content-Type: text/html Content-Length: 544 Connection: close 
Server Error
The requested URL cannot be accessed due to a system error on this server. 
AOLserver/3.4 on http://doesn'tmatter.com
Here are the steps I've taken to implement the search so far: Step 1:
Edited /web/myweb/parameters/myweb.tcl and made sure UseOpenACSSearch was equal to 1... here's a list of relevant parameters from my myweb.tcl:

ns_param UseOpenACSSearch 1
ns_param UseContext 0
ns_param UsePLS 0
ns_param LinktoAltaVista 0
ns_param InterestLevelThreshold 4
ns_param UserCanAddTopicsP 1
ns_param UseNsPermAuthorizationP 0
ns_param FileUploadingEnabledP 1

Step 2: As user 'postgres' I typed: createlang plsql mydb

Step 3: psql -q -U nsadmin mydb /web/myweb/www/doc/sql/rank-for-search.sql

To test the search function I enter strings I know exist in the bulletin board messages both in the title and body of the questions and answers, but so far, no luck.

On the log file, I see the following 2 errors:
Error: dbinit: error(localhost::myweb,ERROR: 
Function 'rank_for_search(unknown, text)' does not exists
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts): ' ... Error: Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")
Database operation "select" failed (exception NSDB, "Query was not a statement returning rows." )
while executing
"ns_db select $db $sql"
invoked from within
"if {[bboard_pls_blade_installed_p} {
ns_write "Sorry, PLS is not yet supported by OpenACS
"
[bboard_footer]
return
...
I also have this parameter set to zero:

ns_param UsePLS 0

You've added pl/Tcl to "mydb" but are using "myweb" in AOLserver?
yes, Don. I'm using 'myweb' on aol server as the aol server name.  The database, I named 'mydb' when I created it in postgresql via the createdb command. The two names don't have to be the same, I would think, right?  So far, the rest of the ACS works fine. It's only the search that doesn't.  Reading this thread prompted me to make the search work.
Is there a pgsql command I can issue from the mydb# prompt to find out if the pltcl lang is defined on mydb database?
as user 'nsadmin' I ran this command at the unix prompt:
linux$   createlang -l mydf

I got:
Procedural languages
Name    |  Trusted?   | Compiler
--------+-------------+-----------
 plpgsql|  t          | PL/pgSQL
 pltcl  |  t          | PL/tcl
(2 rows)
An interesting fact from Doc on createlang command:
PGLIB must point to /usr/lib/pgsql or wherever the 'pltcl.so' static library is found...

When I typed
linux # echo $PGLIB
I got a blank line. I'll see if setting the variable PGLIB to /usr/lib/pgsql on user postgres's .bashrc or even on /etc/rc.d/rc.local upon bootup fixes things... Maybe this is a hint that I may have screwed something up when I installed postgresql since PGLIB isn't defined, but PGDATA is.
yes, Don. I'm using 'myweb' on aol server as the aol server name. The database, I named 'mydb' when I created it in postgresql via the createdb command. The two names don't have to be the same, I would think, right?
No, of course they don't have to be the same.

But

localhost::myweb
says "open the databsae myweb on localhost", not "open the database mydb on localhost".

If you want to open mydb running as pgsql user myweb, you need to set your datasource to localhost::mydb and username to myweb in your database pools.

Found a solution to the problem, Don. All I needed to do is login into pgsql as nsadmin and once there, type:

i /www/myweb/www/doc/sql/rank-for-search.sql
I figured this out by typing out the script you include for loading the data model. The 'i' command did load the function rank-for-search.sql.

I'm a happy searcher now.

ooopsss.. html processing ate the backslashes preceding the i... What's the &<format>; for the backslash? anyone know?

it shoud read:  i /www/myweb/...*.sql

What I learned here is that not having PGLIB defined to /usr/lib/pgsql when I loaded the data model, caused the rank-for-search.sql module not to load.
Here is the complete solution, I use purely RPMS for the whole OACS, including Aolserver and Postgresql. I assume it should be pretty much the same as the source tarball:

1. copy or symlink the file

/usr/lib/pgsql/pltcl.so

to

/usr/local/pgsql/lib/pltcl.so

2. run the following:

psql -f [server_root]/www/doc/sql/postgres-pgtcl.sql acs postgres

psql -f [server_root]/www/doc/sql/rank-for-search.sql acs postgres

3. check the OpenacsSearch paramenter in the config file (this should have been set to 1 already for RPM).

4. Done! Test it under /bboard...

Sincerely,

You can use &#92; for "\".

it's postgres eating the . I put a patch for this at https://openacs.org/sdm/one-patch.tcl?patch_id=35 and Don Baccus has talked of altering the postgres driver to bring it in line with sql92 by not treating the as an escape character.
My patch will only work for OpenACS 4 (and other programs using bind variable substitution, i.e. passing :tcl_var rather than '$tcl_var').

I've made my changes but haven't put them up on openacs.org, yet.  I will in the next few days.