Consistently use "superuser" instead of "super user"
[pgsql.git] / src / include / tsearch / ts_public.h
blobadb9ae5fb9c29c08fbcb944a27561d092cf68b22
1 /*-------------------------------------------------------------------------
3 * ts_public.h
4 * Public interface to various tsearch modules, such as
5 * parsers and dictionaries.
7 * Copyright (c) 1998-2021, PostgreSQL Global Development Group
9 * src/include/tsearch/ts_public.h
11 *-------------------------------------------------------------------------
13 #ifndef _PG_TS_PUBLIC_H_
14 #define _PG_TS_PUBLIC_H_
16 #include "tsearch/ts_type.h"
19 * Parser's framework
23 * returning type for prslextype method of parser
25 typedef struct
27 int lexid;
28 char *alias;
29 char *descr;
30 } LexDescr;
33 * Interface to headline generator
35 typedef struct
37 uint32 selected:1,
38 in:1,
39 replace:1,
40 repeated:1,
41 skip:1,
42 unused:3,
43 type:8,
44 len:16;
45 WordEntryPos pos;
46 char *word;
47 QueryOperand *item;
48 } HeadlineWordEntry;
50 typedef struct
52 HeadlineWordEntry *words;
53 int32 lenwords;
54 int32 curwords;
55 int32 vectorpos; /* positions a-la tsvector */
56 char *startsel;
57 char *stopsel;
58 char *fragdelim;
59 int16 startsellen;
60 int16 stopsellen;
61 int16 fragdelimlen;
62 } HeadlineParsedText;
65 * Common useful things for tsearch subsystem
67 extern char *get_tsearch_config_filename(const char *basename,
68 const char *extension);
71 * Often useful stopword list management
73 typedef struct
75 int len;
76 char **stop;
77 } StopList;
79 extern void readstoplist(const char *fname, StopList *s,
80 char *(*wordop) (const char *));
81 extern bool searchstoplist(StopList *s, char *key);
84 * Interface with dictionaries
87 /* return struct for any lexize function */
88 typedef struct
90 /*----------
91 * Number of current variant of split word. For example the Norwegian
92 * word 'fotballklubber' has two variants to split: ( fotball, klubb )
93 * and ( fot, ball, klubb ). So, dictionary should return:
95 * nvariant lexeme
96 * 1 fotball
97 * 1 klubb
98 * 2 fot
99 * 2 ball
100 * 2 klubb
102 * In general, a TSLexeme will be considered to belong to the same split
103 * variant as the previous one if they have the same nvariant value.
104 * The exact values don't matter, only changes from one lexeme to next.
105 *----------
107 uint16 nvariant;
109 uint16 flags; /* See flag bits below */
111 char *lexeme; /* C string */
112 } TSLexeme;
114 /* Flag bits that can appear in TSLexeme.flags */
115 #define TSL_ADDPOS 0x01
116 #define TSL_PREFIX 0x02
117 #define TSL_FILTER 0x04
120 * Struct for supporting complex dictionaries like thesaurus.
121 * 4th argument for dictlexize method is a pointer to this
123 typedef struct
125 bool isend; /* in: marks for lexize_info about text end is
126 * reached */
127 bool getnext; /* out: dict wants next lexeme */
128 void *private_state; /* internal dict state between calls with
129 * getnext == true */
130 } DictSubState;
132 #endif /* _PG_TS_PUBLIC_H_ */