PostgreSQL Source Code
git master
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
Functions
Variables
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
f
h
i
n
o
p
r
s
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
ts_public.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* ts_public.h
4
* Public interface to various tsearch modules, such as
5
* parsers and dictionaries.
6
*
7
* Copyright (c) 1998-2024, PostgreSQL Global Development Group
8
*
9
* src/include/tsearch/ts_public.h
10
*
11
*-------------------------------------------------------------------------
12
*/
13
#ifndef _PG_TS_PUBLIC_H_
14
#define _PG_TS_PUBLIC_H_
15
16
#include "
tsearch/ts_type.h
"
17
18
/*
19
* Parser's framework
20
*/
21
22
/*
23
* returning type for prslextype method of parser
24
*/
25
typedef
struct
26
{
27
int
lexid
;
28
char
*
alias
;
29
char
*
descr
;
30
}
LexDescr
;
31
32
/*
33
* Interface to headline generator (tsparser's prsheadline function)
34
*
35
* HeadlineParsedText describes the text that is to be highlighted.
36
* Some fields are passed from the core code to the prsheadline function,
37
* while others are output from the prsheadline function.
38
*
39
* The principal data is words[], an array of HeadlineWordEntry,
40
* one entry per token, of length curwords.
41
* The fields of HeadlineWordEntry are:
42
*
43
* in, selected, replace, skip: these flags are initially zero
44
* and may be set by the prsheadline function. A consecutive group
45
* of tokens marked "in" form a "fragment" to be output.
46
* Such tokens may additionally be marked selected, replace, or skip
47
* to modify how they are shown. (If you set more than one of those
48
* bits, you get an unspecified one of those behaviors.)
49
*
50
* type, len, pos, word: filled by core code to describe the token.
51
*
52
* item: if the token matches any operand of the tsquery of interest,
53
* a pointer to such an operand. (If there are multiple matching
54
* operands, we generate extra copies of the HeadlineWordEntry to hold
55
* all the pointers. The extras are marked with repeated = 1 and should
56
* be ignored except for checking the item pointer.)
57
*/
58
typedef
struct
59
{
60
uint32
selected
:1,
/* token is to be highlighted */
61
in
:1,
/* token is part of headline */
62
replace
:1,
/* token is to be replaced with a space */
63
repeated
:1,
/* duplicate entry to hold item pointer */
64
skip
:1,
/* token is to be skipped (not output) */
65
unused
:3,
/* available bits */
66
type
:8,
/* parser's token category */
67
len
:16;
/* length of token */
68
WordEntryPos
pos
;
/* position of token */
69
char
*
word
;
/* text of token (not null-terminated) */
70
QueryOperand
*
item
;
/* a matching query operand, or NULL if none */
71
}
HeadlineWordEntry
;
72
73
typedef
struct
74
{
75
/* Fields filled by core code before calling prsheadline function: */
76
HeadlineWordEntry
*
words
;
77
int32
lenwords
;
/* allocated length of words[] */
78
int32
curwords
;
/* current number of valid entries */
79
int32
vectorpos
;
/* used by ts_parse.c in filling pos fields */
80
81
/* The prsheadline function must fill these fields: */
82
/* Strings for marking selected tokens and separating fragments: */
83
char
*
startsel
;
/* palloc'd strings */
84
char
*
stopsel
;
85
char
*
fragdelim
;
86
int16
startsellen
;
/* lengths of strings */
87
int16
stopsellen
;
88
int16
fragdelimlen
;
89
}
HeadlineParsedText
;
90
91
/*
92
* Common useful things for tsearch subsystem
93
*/
94
extern
char
*
get_tsearch_config_filename
(
const
char
*basename,
95
const
char
*extension);
96
97
/*
98
* Often useful stopword list management
99
*/
100
typedef
struct
101
{
102
int
len
;
103
char
**
stop
;
104
}
StopList
;
105
106
extern
void
readstoplist
(
const
char
*fname,
StopList
*s,
107
char
*(*wordop) (
const
char
*,
size_t
,
Oid
));
108
extern
bool
searchstoplist
(
StopList
*s,
char
*
key
);
109
110
/*
111
* Interface with dictionaries
112
*/
113
114
/* return struct for any lexize function */
115
typedef
struct
116
{
117
/*----------
118
* Number of current variant of split word. For example the Norwegian
119
* word 'fotballklubber' has two variants to split: ( fotball, klubb )
120
* and ( fot, ball, klubb ). So, dictionary should return:
121
*
122
* nvariant lexeme
123
* 1 fotball
124
* 1 klubb
125
* 2 fot
126
* 2 ball
127
* 2 klubb
128
*
129
* In general, a TSLexeme will be considered to belong to the same split
130
* variant as the previous one if they have the same nvariant value.
131
* The exact values don't matter, only changes from one lexeme to next.
132
*----------
133
*/
134
uint16
nvariant
;
135
136
uint16
flags
;
/* See flag bits below */
137
138
char
*
lexeme
;
/* C string */
139
}
TSLexeme
;
140
141
/* Flag bits that can appear in TSLexeme.flags */
142
#define TSL_ADDPOS 0x01
143
#define TSL_PREFIX 0x02
144
#define TSL_FILTER 0x04
145
146
/*
147
* Struct for supporting complex dictionaries like thesaurus.
148
* 4th argument for dictlexize method is a pointer to this
149
*/
150
typedef
struct
151
{
152
bool
isend
;
/* in: marks for lexize_info about text end is
153
* reached */
154
bool
getnext
;
/* out: dict wants next lexeme */
155
void
*
private_state
;
/* internal dict state between calls with
156
* getnext == true */
157
}
DictSubState
;
158
159
#endif
/* _PG_TS_PUBLIC_H_ */
int16
int16_t int16
Definition:
c.h:480
int32
int32_t int32
Definition:
c.h:481
uint16
uint16_t uint16
Definition:
c.h:484
uint32
uint32_t uint32
Definition:
c.h:485
sort-test.key
key
Definition:
sort-test.py:19
Oid
unsigned int Oid
Definition:
postgres_ext.h:31
DictSubState
Definition:
ts_public.h:151
DictSubState::private_state
void * private_state
Definition:
ts_public.h:155
DictSubState::isend
bool isend
Definition:
ts_public.h:152
DictSubState::getnext
bool getnext
Definition:
ts_public.h:154
HeadlineParsedText
Definition:
ts_public.h:74
HeadlineParsedText::words
HeadlineWordEntry * words
Definition:
ts_public.h:76
HeadlineParsedText::stopsel
char * stopsel
Definition:
ts_public.h:84
HeadlineParsedText::startsellen
int16 startsellen
Definition:
ts_public.h:86
HeadlineParsedText::curwords
int32 curwords
Definition:
ts_public.h:78
HeadlineParsedText::fragdelim
char * fragdelim
Definition:
ts_public.h:85
HeadlineParsedText::stopsellen
int16 stopsellen
Definition:
ts_public.h:87
HeadlineParsedText::lenwords
int32 lenwords
Definition:
ts_public.h:77
HeadlineParsedText::startsel
char * startsel
Definition:
ts_public.h:83
HeadlineParsedText::vectorpos
int32 vectorpos
Definition:
ts_public.h:79
HeadlineParsedText::fragdelimlen
int16 fragdelimlen
Definition:
ts_public.h:88
HeadlineWordEntry
Definition:
ts_public.h:59
HeadlineWordEntry::skip
uint32 skip
Definition:
ts_public.h:64
HeadlineWordEntry::type
uint32 type
Definition:
ts_public.h:66
HeadlineWordEntry::in
uint32 in
Definition:
ts_public.h:61
HeadlineWordEntry::repeated
uint32 repeated
Definition:
ts_public.h:63
HeadlineWordEntry::replace
uint32 replace
Definition:
ts_public.h:62
HeadlineWordEntry::pos
WordEntryPos pos
Definition:
ts_public.h:68
HeadlineWordEntry::len
uint32 len
Definition:
ts_public.h:67
HeadlineWordEntry::word
char * word
Definition:
ts_public.h:69
HeadlineWordEntry::selected
uint32 selected
Definition:
ts_public.h:60
HeadlineWordEntry::item
QueryOperand * item
Definition:
ts_public.h:70
HeadlineWordEntry::unused
uint32 unused
Definition:
ts_public.h:65
LexDescr
Definition:
ts_public.h:26
LexDescr::alias
char * alias
Definition:
ts_public.h:28
LexDescr::lexid
int lexid
Definition:
ts_public.h:27
LexDescr::descr
char * descr
Definition:
ts_public.h:29
QueryOperand
Definition:
ts_type.h:157
StopList
Definition:
ts_public.h:101
StopList::len
int len
Definition:
ts_public.h:102
StopList::stop
char ** stop
Definition:
ts_public.h:103
TSLexeme
Definition:
ts_public.h:116
TSLexeme::nvariant
uint16 nvariant
Definition:
ts_public.h:134
TSLexeme::lexeme
char * lexeme
Definition:
ts_public.h:138
TSLexeme::flags
uint16 flags
Definition:
ts_public.h:136
readstoplist
void readstoplist(const char *fname, StopList *s, char *(*wordop)(const char *, size_t, Oid))
Definition:
ts_utils.c:69
searchstoplist
bool searchstoplist(StopList *s, char *key)
Definition:
ts_utils.c:141
get_tsearch_config_filename
char * get_tsearch_config_filename(const char *basename, const char *extension)
Definition:
ts_utils.c:34
ts_type.h
WordEntryPos
uint16 WordEntryPos
Definition:
ts_type.h:63
src
include
tsearch
ts_public.h
Generated on Mon Dec 30 2024 06:13:25 for PostgreSQL Source Code by
1.9.4