I still didn't get how tsquery is internally

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-hackers(at)postgresql(dot)org
Subject: I still didn't get how tsquery is internally
Date: 2010-02-10 19:08:50
Message-ID: 20100210200850.4826c5ad@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 tsquery
AS '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

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2010-02-10 19:16:59 Re: [PATCH] Output configuration status after ./configure run.
Previous Message Robert Haas 2010-02-10 19:01:57 Re: [PATCH] Output configuration status after ./configure run.