aboutsummaryrefslogtreecommitdiff
path: root/contrib/tsearch2/ts_cfg.h
blob: 9bf65144b208591b167b44869a6a5e1463ab0b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef __TS_CFG_H__
#define __TS_CFG_H__

#include "postgres.h"
#include "query.h"


typedef struct
{
	int			len;
	Datum	   *dict_id;
}	ListDictionary;

typedef struct
{
	Oid			id;
	Oid			prs_id;
	int			len;
	ListDictionary *map;
}	TSCfgInfo;

Oid			name2id_cfg(text *name);
TSCfgInfo  *findcfg(Oid id);
void		init_cfg(Oid id, TSCfgInfo * cfg);
void		reset_cfg(void);

typedef struct
{
	uint16		len;
	union
	{
		uint16		pos;
		uint16	   *apos;
	}			pos;
	char	   *word;
	uint32		alen;
}	TSWORD;

typedef struct
{
	TSWORD	   *words;
	int4		lenwords;
	int4		curwords;
	int4		pos;
}	PRSTEXT;

typedef struct
{
	uint16		len;
	uint8		selected:1,
				in:1,
				skip:1,
				replace:1,
				repeated:1;
	uint8		type;
	char	   *word;
	ITEM	   *item;
}	HLWORD;

typedef struct
{
	HLWORD	   *words;
	int4		lenwords;
	int4		curwords;
	char	   *startsel;
	char	   *stopsel;
	int2		startsellen;
	int2		stopsellen;
}	HLPRSTEXT;

void		hlparsetext(TSCfgInfo * cfg, HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int4 buflen);
text	   *genhl(HLPRSTEXT * prs);

void		parsetext_v2(TSCfgInfo * cfg, PRSTEXT * prs, char *buf, int4 buflen);
int			get_currcfg(void);

#endif