aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/tsginidx.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2007-09-11 08:46:29 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2007-09-11 08:46:29 +0000
commit57cafe79823dcd3653cf5e19cbdf58300cb1576c (patch)
tree8616fa0d0c77fd151cf874184fa5f21f56717aef /src/backend/utils/adt/tsginidx.c
parentef4d38c86c1b1f834bd70115fd19f03431573c2d (diff)
downloadpostgresql-57cafe79823dcd3653cf5e19cbdf58300cb1576c.tar.gz
postgresql-57cafe79823dcd3653cf5e19cbdf58300cb1576c.zip
Refactor from Heikki Linnakangas <heikki@enterprisedb.com>:
* Defined new struct WordEntryPosVector that holds a uint16 length and a variable size array of WordEntries. This replaces the previous convention of a variable size uint16 array, with the first element implying the length. WordEntryPosVector has the same layout in memory, but is more readable in source code. The POSDATAPTR and POSDATALEN macros are still used, though it would now be more readable to access the fields in WordEntryPosVector directly. * Removed needfree field from DocRepresentation. It was always set to false. * Miscellaneous other commenting and refactoring
Diffstat (limited to 'src/backend/utils/adt/tsginidx.c')
-rw-r--r--src/backend/utils/adt/tsginidx.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c
index 974a1b7ae4e..ba4a10313cb 100644
--- a/src/backend/utils/adt/tsginidx.c
+++ b/src/backend/utils/adt/tsginidx.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/tsginidx.c,v 1.3 2007/09/07 16:03:40 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/tsginidx.c,v 1.4 2007/09/11 08:46:29 teodor Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,13 +25,12 @@ gin_extract_tsvector(PG_FUNCTION_ARGS)
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
Datum *entries = NULL;
- *nentries = 0;
+ *nentries = vector->size;
if (vector->size > 0)
{
int i;
WordEntry *we = ARRPTR(vector);
- *nentries = (uint32) vector->size;
entries = (Datum *) palloc(sizeof(Datum) * vector->size);
for (i = 0; i < vector->size; i++)
@@ -134,11 +133,19 @@ gin_ts_consistent(PG_FUNCTION_ARGS)
if (query->size > 0)
{
- int4 i,
+ int i,
j = 0;
QueryItem *item;
GinChkVal gcv;
+ /*
+ * check-parameter array has one entry for each value (operand) in the
+ * query. We expand that array into mapped_check, so that there's one
+ * entry in mapped_check for every node in the query, including
+ * operators, to allow quick lookups in checkcondition_gin. Only the
+ * entries corresponding operands are actually used.
+ */
+
gcv.frst = item = GETQUERY(query);
gcv.mapped_check = (bool *) palloc(sizeof(bool) * query->size);