summaryrefslogtreecommitdiff
path: root/contrib/tsearch2/dict.h
blob: bbbbfc47a51d1ee8a2f15d8655054b6341da19f9 (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
#ifndef __DICT_H__
#define __DICT_H__
#include "postgres.h"
#include "fmgr.h"

typedef struct {
	int len;
	char	**stop;
	char*	(*wordop)(char*);
} StopList;

void sortstoplist(StopList *s);
void freestoplist(StopList *s); 
void readstoplist(text *in, StopList *s);
bool searchstoplist(StopList *s, char *key);
char* lowerstr(char *str);

typedef struct {
	Oid dict_id;
	FmgrInfo lexize_info;
	void *dictionary;
} DictInfo;

void init_dict(Oid id, DictInfo *dict);
DictInfo* finddict(Oid id);
Oid name2id_dict(text *name);
void reset_dict(void);


/* simple parser of cfg string */
typedef struct {
        char    *key;
        char    *value;
} Map;

void parse_cfgdict(text *in, Map **m);

#endif