2001-10-13 07:19:09 +08:00
|
|
|
#ifndef __TXTIDX_H__
|
|
|
|
#define __TXTIDX_H__
|
|
|
|
|
|
|
|
/*
|
|
|
|
#define TXTIDX_DEBUG
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "postgres.h"
|
|
|
|
|
|
|
|
#include "access/gist.h"
|
|
|
|
#include "access/itup.h"
|
|
|
|
#include "utils/builtins.h"
|
|
|
|
#include "storage/bufpage.h"
|
|
|
|
|
2001-10-25 13:50:21 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint16 len;
|
|
|
|
uint16 pos;
|
2001-11-06 01:46:40 +08:00
|
|
|
} WordEntry;
|
2001-10-25 13:50:21 +08:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int4 len;
|
|
|
|
int4 size;
|
|
|
|
char data[1];
|
2001-11-06 01:46:40 +08:00
|
|
|
} txtidx;
|
2001-10-25 13:50:21 +08:00
|
|
|
|
|
|
|
#define DATAHDRSIZE (sizeof(int4)*2)
|
|
|
|
#define CALCDATASIZE(x, lenstr) ( x * sizeof(WordEntry) + DATAHDRSIZE + lenstr )
|
|
|
|
#define ARRPTR(x) ( (WordEntry*) ( (char*)x + DATAHDRSIZE ) )
|
|
|
|
#define STRPTR(x) ( (char*)x + DATAHDRSIZE + ( sizeof(WordEntry) * ((txtidx*)x)->size ) )
|
|
|
|
#define STRSIZE(x) ( ((txtidx*)x)->len - DATAHDRSIZE - ( sizeof(WordEntry) * ((txtidx*)x)->size ) )
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char *prsbuf;
|
|
|
|
char *word;
|
|
|
|
char *curpos;
|
|
|
|
int4 len;
|
|
|
|
int4 state;
|
|
|
|
bool oprisdelim;
|
2001-11-06 01:46:40 +08:00
|
|
|
} TI_IN_STATE;
|
2001-10-25 13:50:21 +08:00
|
|
|
|
|
|
|
int4 gettoken_txtidx(TI_IN_STATE * state);
|
2001-10-28 14:26:15 +08:00
|
|
|
|
2001-10-13 07:19:09 +08:00
|
|
|
#endif
|