From: | markw <markw(at)mohawksoft(dot)com> |
---|---|
To: | pgsql-announce(at)postgresql(dot)org(dot)pgsql-general(at)postgresql(dot)org |
Subject: | Boolean text, with phrase ranking, search under Postgres |
Date: | 2000-10-16 18:32:38 |
Message-ID: | 39EB49C6.225A89E9@mohawksoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-announce pgsql-general |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Edmar Wiggers | 2000-10-17 00:06:42 | C function returning rows, was Boolean text, with phrase ranking, search under Postgres |
Previous Message | Joerg Hessdoerfer | 2000-10-16 16:12:38 | Re: New PostgreSQL binary distro for Windows NT |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2000-10-16 18:36:45 | Re: [GENERAL] PL/Perl compilation error |
Previous Message | Joseph Shraibman | 2000-10-16 17:59:15 | Re: Error building JDBC Driver |