diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-10-12 23:19:09 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-10-12 23:19:09 +0000 |
| commit | b57705673d02483b6e20d8a4d55a8aa182055d08 (patch) | |
| tree | cb974bb78b96509ab7b8e69f1f43d2bb9658adcf /contrib/tsearch/query.h | |
| parent | c24216bea8ae43b251900d1ce6ca9250943c33e0 (diff) | |
| download | postgresql-b57705673d02483b6e20d8a4d55a8aa182055d08.tar.gz | |
txtidx datatype for full text indexing with GiST.
From Oleg Bartunov and Teodor Sigaev.
Diffstat (limited to 'contrib/tsearch/query.h')
| -rw-r--r-- | contrib/tsearch/query.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/contrib/tsearch/query.h b/contrib/tsearch/query.h new file mode 100644 index 0000000000..96117e78c8 --- /dev/null +++ b/contrib/tsearch/query.h @@ -0,0 +1,49 @@ +#ifndef __QUERY_H__ +#define __QUERY_H__ +/* +#define BS_DEBUG +*/ + + +/* + * item in polish notation with back link + * to left operand + */ +typedef struct ITEM { + int2 type; + int2 left; + int4 val; + /* user-friendly value */ + uint16 distance; + uint16 length; +} ITEM; + +/* + *Storage: + * (len)(size)(array of ITEM)(array of operand in user-friendly form) + */ +typedef struct { + int4 len; + int4 size; + char data[1]; +} QUERYTYPE; + +#define HDRSIZEQT ( 2*sizeof(int4) ) +#define COMPUTESIZE(size,lenofoperand) ( HDRSIZEQT + size * sizeof(ITEM) + lenofoperand ) +#define GETQUERY(x) (ITEM*)( (char*)(x)+HDRSIZEQT ) +#define GETOPERAND(x) ( (char*)GETQUERY(x) + ((QUERYTYPE*)x)->size * sizeof(ITEM) ) + +#define ISOPERATOR(x) ( (x)=='!' || (x)=='&' || (x)=='|' || (x)=='(' || (x)==')' ) + +#define END 0 +#define ERR 1 +#define VAL 2 +#define OPR 3 +#define OPEN 4 +#define CLOSE 5 +#define VALTRUE 6 /* for stop words */ +#define VALFALSE 7 + +bool execute( ITEM* curitem, void *checkval, + bool calcnot, bool (*chkcond)(void *checkval, ITEM* val )); +#endif |
