34
34
#define TS_EXEC_PHRASE_NO_POS TS_EXEC_PHRASE_AS_AND
35
35
#endif
36
36
37
- #ifndef TSTernaryValue
38
37
typedef enum
39
38
{
40
39
TS_NO , /* definitely no match */
41
40
TS_YES , /* definitely does match */
42
41
TS_MAYBE /* can't verify match for lack of pos data */
43
- } TSTernaryValue ;
44
- typedef TSTernaryValue (* TSExecuteCallbackTernary ) (void * arg , QueryOperand * val , ExecPhraseData * data );
45
- #endif
42
+ } RumTernaryValue ;
43
+ typedef RumTernaryValue (* RumExecuteCallbackTernary ) (void * arg , QueryOperand * val , ExecPhraseData * data );
44
+
46
45
47
46
PG_FUNCTION_INFO_V1 (rum_extract_tsvector );
48
47
PG_FUNCTION_INFO_V1 (rum_extract_tsvector_hash );
@@ -70,19 +69,19 @@ static Datum build_tsvector_hash_entry(TSVector vector, WordEntry *we);
70
69
static Datum build_tsquery_entry (TSQuery query , QueryOperand * operand );
71
70
static Datum build_tsquery_hash_entry (TSQuery query , QueryOperand * operand );
72
71
73
- static TSTernaryValue
72
+ static RumTernaryValue
74
73
rum_phrase_output (ExecPhraseData * data , ExecPhraseData * Ldata , ExecPhraseData * Rdata ,
75
74
int emit ,
76
75
int Loffset ,
77
76
int Roffset ,
78
77
int max_npos );
79
- static TSTernaryValue
78
+ static RumTernaryValue
80
79
rum_phrase_execute (QueryItem * curitem , void * arg , uint32 flags ,
81
- TSExecuteCallbackTernary chkcond ,
80
+ RumExecuteCallbackTernary chkcond ,
82
81
ExecPhraseData * data );
83
- static TSTernaryValue
82
+ static RumTernaryValue
84
83
rum_TS_execute (QueryItem * curitem , void * arg , uint32 flags ,
85
- TSExecuteCallbackTernary chkcond );
84
+ RumExecuteCallbackTernary chkcond );
86
85
87
86
typedef Datum (* TSVectorEntryBuilder )(TSVector vector , WordEntry * we );
88
87
typedef Datum (* TSQueryEntryBuilder )(TSQuery query , QueryOperand * operand );
@@ -229,7 +228,7 @@ rum_tsquery_pre_consistent(PG_FUNCTION_ARGS)
229
228
}
230
229
231
230
232
- static TSTernaryValue
231
+ static RumTernaryValue
233
232
checkcondition_rum (void * checkval , QueryOperand * val , ExecPhraseData * data )
234
233
{
235
234
RumChkVal * gcv = (RumChkVal * ) checkval ;
@@ -302,13 +301,13 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
302
301
* "!word:A" can mean both: "word:BCВ" or "!word"
303
302
*/
304
303
else if (val -> weight == 0 )
305
- /* Query without weigths */
304
+ /* Query without weights */
306
305
return TS_YES ;
307
306
else
308
307
{
309
308
char KeyWeightsMask = 0 ;
310
309
311
- /* Fill KeyWeightMask contains with weigths from all positions */
310
+ /* Fill KeyWeightMask contains with weights from all positions */
312
311
for (i = 0 ; i < npos ; i ++ )
313
312
{
314
313
ptrt = decompress_pos (ptrt , & post );
@@ -339,7 +338,7 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
339
338
* negative positions, which won't fit into WordEntryPos.
340
339
*
341
340
* The result is boolean (TS_YES or TS_NO), but for the caller's convenience
342
- * we return it as TSTernaryValue .
341
+ * we return it as RumTernaryValue .
343
342
*
344
343
* Returns TS_YES if any positions were emitted to *data; or if data is NULL,
345
344
* returns TS_YES if any positions would have been emitted.
@@ -348,7 +347,7 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
348
347
#define TSPO_R_ONLY 0x02 /* emit positions appearing only in R */
349
348
#define TSPO_BOTH 0x04 /* emit positions appearing in both L&R */
350
349
351
- static TSTernaryValue
350
+ static RumTernaryValue
352
351
rum_phrase_output (ExecPhraseData * data ,
353
352
ExecPhraseData * Ldata ,
354
353
ExecPhraseData * Rdata ,
@@ -481,22 +480,22 @@ rum_phrase_output(ExecPhraseData *data,
481
480
* the starts. (This unintuitive rule is needed to avoid possibly generating
482
481
* negative positions, which wouldn't fit into the WordEntryPos arrays.)
483
482
*
484
- * If the TSExecuteCallback function reports that an operand is present
483
+ * If the RumExecuteCallback function reports that an operand is present
485
484
* but fails to provide position(s) for it, we will return TS_MAYBE when
486
485
* it is possible but not certain that the query is matched.
487
486
*
488
487
* When the function returns TS_NO or TS_MAYBE, it must return npos = 0,
489
488
* negate = false (which is the state initialized by the caller); but the
490
489
* "width" output in such cases is undefined.
491
490
*/
492
- static TSTernaryValue
491
+ static RumTernaryValue
493
492
rum_phrase_execute (QueryItem * curitem , void * arg , uint32 flags ,
494
- TSExecuteCallbackTernary chkcond ,
493
+ RumExecuteCallbackTernary chkcond ,
495
494
ExecPhraseData * data )
496
495
{
497
496
ExecPhraseData Ldata ,
498
497
Rdata ;
499
- TSTernaryValue lmatch ,
498
+ RumTernaryValue lmatch ,
500
499
rmatch ;
501
500
int Loffset ,
502
501
Roffset ,
@@ -737,12 +736,11 @@ rum_phrase_execute(QueryItem *curitem, void *arg, uint32 flags,
737
736
* chkcond: callback function to check whether a primitive value is present
738
737
*/
739
738
740
- static TSTernaryValue
739
+ static RumTernaryValue
741
740
rum_TS_execute (QueryItem * curitem , void * arg , uint32 flags ,
742
- TSExecuteCallbackTernary chkcond )
741
+ RumExecuteCallbackTernary chkcond )
743
742
{
744
- TSTernaryValue lmatch ;
745
-
743
+ RumTernaryValue lmatch ;
746
744
/* since this function recurses, it could be driven to stack overflow */
747
745
check_stack_depth ();
748
746
@@ -847,7 +845,7 @@ rum_tsquery_consistent(PG_FUNCTION_ARGS)
847
845
Datum * addInfo = (Datum * ) PG_GETARG_POINTER (8 );
848
846
bool * addInfoIsNull = (bool * ) PG_GETARG_POINTER (9 );
849
847
850
- TSTernaryValue res = TS_NO ;
848
+ RumTernaryValue res = TS_NO ;
851
849
852
850
/*
853
851
* The query doesn't require recheck by default
@@ -892,7 +890,7 @@ rum_tsquery_timestamp_consistent(PG_FUNCTION_ARGS)
892
890
bool * recheck = (bool * ) PG_GETARG_POINTER (5 );
893
891
Datum * addInfo = (Datum * ) PG_GETARG_POINTER (8 );
894
892
bool * addInfoIsNull = (bool * ) PG_GETARG_POINTER (9 );
895
- TSTernaryValue res = TS_NO ;
893
+ RumTernaryValue res = TS_NO ;
896
894
897
895
/*
898
896
* The query requires recheck only if it involves weights
0 commit comments