Forum OpenACS Development: OpenFTS 0.3.2 ranking problem (relor sql function)

Hi all, I just did s fresh oacs 4.6, pg 7.2.3, nsd 3.4.2 install with all the usual bits 'n pieces (including the postgres contrib bits for openfts).

Difference being, I used fts-tcl 0.3.2 (released nov 18th) instead of 0.3.1.

two things I have found so far:

  1. you need to compile & install the postgres/contrib/tsearch module (don't remember doing that before)
  2. the ranking/ordering function relor seems to have changed - or the get_sql function that builds the query - or something else in the bowels of OpenFTS
(1) is easy to deal with, (2) can be avoided with the following hack in openfts-driver/tcl/openfts-driver-procs.tcl - change the set sql_sort (line 72) to:


    set sql_sort "
        select $self(TXTID) as object_id
        from $self(TABLE)
        where
            $date_range_condition
            $condition
            $permission_check_condition
        limit $limit
        offset $offset"

ie. strip the $out part of the select, which means we no longer have the
select relor( 1.0, 0.01, 0, txt.tid, txt.tid % 10 + 1 , '{"foo"}' ) as pos
(or similar) so we also need to strip out the $order (which says something like order by pos desc)


The reason being, $out is produced as:

relor( 1.0, 0.01, '0', txt.tid,  txt.tid % 10 + 1 , '{"moof"}' ) as pos
where moof is the search term. Notice the third parameter '0' which should be an int. Problem is, this stuff all gets built in never never land which I can't seem to find.

anyone got any ideas, or should I just be sensible and revert to 0.3.1?

Collapse
Posted by Dan Wickstrom on
1. contrib/tsearch is required for openfts 3.2.  It replaces the contrib/intarray usage in previous versions.
2. The relor function did change, but it's not clear to me as to what  kind of error message you're seeing.  Possibly you have mixed versions of openfts by using part of 3.1 and part of 3.2.
Collapse
Posted by Mark Aufflick on
Thanks for the reply Dan. If this makes the problem clearer, I have re-run the problem and get the following errors:

Request Error (in the browser)

Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")
    while executing
"ns_pg_bind select nsdb0 {
        select txt.tid as object_id,
 relor( 1.0, 0.01, '0', txt.tid,  txt.tid % 10 + 1 , '{"moof"}' ) as pos 
        from ..."

Postgres error
ERROR:  Function 'relor(float8, float8, unknown, int4, int4, unknown)' does not exist
        Unable to identify a function that satisfies the given argument types
        You may need to add explicit typecasts

Another issue I am seeing, is that when etp pages are returned as search results (via the content_revision/content_template Fts bindings I guess), the link generated is something like
/acs-content-repository/test/index?revision_id=3132
which breaks a constraint:
Error: Ns_PgExec: result status: 7 message: ERROR:  -20000: Invalid item ID: <NULL>
presumably because no item_id is specified (although you could figure it out from the revision_id). A bit of digging through the content repository tells me I need to understand it better than I do :) Can anyone point me to which tcl file actually gets called for an url like this?

Thanks so much everyone - and have a great Christmas!

Collapse
Posted by Mark Aufflick on
duh... (or perhaps vuh...) cancel the last question.

It is of course packages/acs-content-repository/www/index.vuh