Boolean text, with phrase ranking, search under Postgres - Mailing list pgsql-announce

From markw
Subject Boolean text, with phrase ranking, search under Postgres
Date
Msg-id 39EB49C6.225A89E9@mohawksoft.com
Whole thread Raw
List pgsql-announce
I am working on a GPL version of a boolean text search engine for
PostgreSQL.

How it works:

You run a program which executes a query and builds a set of external
indexes.

Then you run a daemon process which does the processing of the text
query.

In postgres, you create a temporary table of results, call textsearch
which populates the table,
lastly, you join with the results table. The code looks like this:

>>>>>>>>>>>>>
--
-- Create a temporary table for search results
--
create temp table search_result (key integer, rank integer);
--
-- Call search daemon to populate table
--
select textsearch('performer2{ waitresses } song { i know what boys like
}');
--
-- Join result table with data tables
--
select title, song, performer2, rank from zsong, ztitles, search_result
        where search_result.key = zsong.trackid and
        zsong.muzenbr = ztitles.muzenbr
        order by search_result.rank desc;
--
-- Finished with result table, drop it.
--
drop table search_result ;
<<<<<<<<<<<<<<<<

he textsearch function looks like:
>>>>>>>>>>>>>>>>>>>>>>>>
create function textsearch(varchar) returns integer as
        '
        DECLARE
                handle  integer;
                count   integer;
                pos     integer;
        BEGIN
                handle = search_exec( \'localhost\', $1);

                count = search_count(handle);

                for pos in 0 .. count-1 loop
                        insert into search_result(key, rank)
                        values (search_key(handle,pos),
search_rank(handle,pos));
                end loop;

                return search_done(handle);

        END;
' language 'plpgsql';


What I would like to do is create the result table in the function
and/or accept a table name as a parameter. I can't seem to do this,
perhaps I am missing something trivial.

Is there a way to create a table from within 'c' and return it?  I am
not a postgres pro, I am a C/C++ guy and do not know the ins and outs of
Postgres, and it should be a lot easier to make something more eficient.
Any insign would be appreciated.


pgsql-announce by date:

Previous
From: Joerg Hessdoerfer
Date:
Subject: New PostgreSQL binary distro for Windows NT
Next
From: Jason Tishler
Date:
Subject: Re: [PORTS] New PostgreSQL binary distro for Windows NT