postgresql/contrib/tsearch2/ts_cfg.h

78 lines
1.1 KiB
C
Raw Normal View History

2003-07-21 18:27:44 +08:00
#ifndef __TS_CFG_H__
#define __TS_CFG_H__
2003-07-21 18:27:44 +08:00
#include "postgres.h"
#include "query.h"
2003-08-04 08:43:34 +08:00
typedef struct
{
int len;
Datum *dict_id;
} ListDictionary;
2003-07-21 18:27:44 +08:00
2003-08-04 08:43:34 +08:00
typedef struct
{
Oid id;
Oid prs_id;
int len;
ListDictionary *map;
2003-07-21 18:27:44 +08:00
} TSCfgInfo;
2003-08-04 08:43:34 +08:00
Oid name2id_cfg(text *name);
TSCfgInfo *findcfg(Oid id);
void init_cfg(Oid id, TSCfgInfo * cfg);
void reset_cfg(void);
2003-07-21 18:27:44 +08:00
2003-08-04 08:43:34 +08:00
typedef struct
{
uint16 len;
union
{
2003-07-21 18:27:44 +08:00
uint16 pos;
2003-08-04 08:43:34 +08:00
uint16 *apos;
} pos;
char *word;
uint32 alen;
} TSWORD;
2003-08-04 08:43:34 +08:00
typedef struct
{
TSWORD *words;
2003-08-04 08:43:34 +08:00
int4 lenwords;
int4 curwords;
2003-07-21 18:27:44 +08:00
int4 pos;
2003-08-04 08:43:34 +08:00
} PRSTEXT;
typedef struct
{
uint32 selected:1,
2003-08-04 08:43:34 +08:00
in:1,
replace:1,
repeated:1,
unused:4,
type:8,
len:16;
2003-08-04 08:43:34 +08:00
char *word;
ITEM *item;
} HLWORD;
2003-07-21 18:27:44 +08:00
2003-08-04 08:43:34 +08:00
typedef struct
{
HLWORD *words;
int4 lenwords;
int4 curwords;
char *startsel;
char *stopsel;
int2 startsellen;
int2 stopsellen;
} HLPRSTEXT;
2003-07-21 18:27:44 +08:00
2003-08-04 08:43:34 +08:00
void hlparsetext(TSCfgInfo * cfg, HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int4 buflen);
text *genhl(HLPRSTEXT * prs);
2003-07-21 18:27:44 +08:00
2003-08-04 08:43:34 +08:00
void parsetext_v2(TSCfgInfo * cfg, PRSTEXT * prs, char *buf, int4 buflen);
int get_currcfg(void);
2003-07-21 18:27:44 +08:00
#endif