I still didn't get how tsquery is internally - Mailing list pgsql-hackers

From Ivan Sergio Borgonovo
Subject I still didn't get how tsquery is internally
Date
Msg-id 20100210200850.4826c5ad@dawn.webthatworks.it
Whole thread Raw
List pgsql-hackers
I've been working on this
http://pgsql.privatepaste.com/2a81432f4f

for 8.3 (there should be some comments to port it to 8.4).

tsvector_tsquery_size works as expected.

But whatever I pass to the function I get an empty tsquery. Yet no
memory allocation problem or hang etc... just an empty vector, but
that's not enough to say I'm not filling distance and left with the
wrong values etc... anyway.

CREATE OR REPLACE FUNCTION tsvector_to_tsquery(IN tsv tsvector, op
IN char(1), weights IN varchar(4), maxpos IN smallint)RETURNS tsqueryAS 'MODULE_PATHNAME'LANGUAGE C STRICT;

The function should turn a tsvector into a tsquery.

op is the operator (| or &)
weights is a filter. lexemes wil be picked up just if they don't
have a position/weight or they have one of the passed weights.
maxpos will filter out all lexemes that have a position>maxpos.

So

tsvector_to_tsquery('java:1A,2B tano:3C,4D', '&', 'ABC', 100) ->

java:A & java:B & tano:C

tsvector_to_tsquery('java:1A,2B tano:3C,4D', '|', 'ABC', 100) ->

java:AB | tano:C


There is also a small problem. The op is always char = 0x08 (even on
a much simpler function that just retrieve op and return it as a
masked int64.
It seems that
char op = PG_GETARG_CHAR(1);
is not really what I thought it to be.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [PATCH] Output configuration status after ./configure run.
Next
From: Alvaro Herrera
Date:
Subject: Re: [PATCH] Output configuration status after ./configure run.