Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4e2a49f

Browse files
committed
Make compatible with PG13 changes in TS_execute and callback interface
1 parente2e2a9f commit4e2a49f

File tree

2 files changed

+45
-4
lines changed

2 files changed

+45
-4
lines changed

‎src/rum.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ typedef struct RumMetaPageData
103103
int64nEntries;
104104
}RumMetaPageData;
105105

106-
#defineRUM_CURRENT_VERSION(0xC0DE0002)
106+
#defineRUM_CURRENT_VERSION(0xC0DE0003)
107107

108108
#defineRumPageGetMeta(p) \
109109
((RumMetaPageData *) PageGetContents(p))

‎src/rum_ts_utils.c

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,33 @@
3434
#defineTS_EXEC_PHRASE_NO_POS TS_EXEC_PHRASE_AS_AND
3535
#endif
3636

37+
#ifPG_VERSION_NUM >=130000
38+
/* Since v13 TS_execute flag naming and defaults have reverted:
39+
* - before v13 - - since v13 -
40+
* TS_EXEC_CALC_NOT (0x01) TS_EXEC_SKIP_NOT (0x01)
41+
*/
42+
#defineTS_EXEC_CALC_NOT (0x01)/* Defined here for use with rum_TS_execute for
43+
*compatibility with version < 13 where this
44+
*flag was defined globally.
45+
*XXX Since v13 current global flag
46+
*TS_EXEC_SKIP_NOT has reverted meaning for
47+
*TS_execute but TS_EXEC_CALC_NOT should still
48+
*be passed to rum_TS_execute in unchanged (previous)
49+
*meaning but should not be passed into TS_execute:
50+
*(TS_execute will do 'calc not' by default, and
51+
*if you need skip it, use new TS_EXEC_SKIP_NOT)
52+
*/
53+
typedefTSTernaryValueRumTernaryValue;
54+
#else
3755
typedefenum
3856
{
3957
TS_NO,/* definitely no match */
4058
TS_YES,/* definitely does match */
4159
TS_MAYBE/* can't verify match for lack of pos data */
4260
}RumTernaryValue;
61+
#endif
4362
typedefRumTernaryValue (*RumExecuteCallbackTernary) (void*arg,QueryOperand*val,ExecPhraseData*data);
4463

45-
4664
PG_FUNCTION_INFO_V1(rum_extract_tsvector);
4765
PG_FUNCTION_INFO_V1(rum_extract_tsvector_hash);
4866
PG_FUNCTION_INFO_V1(rum_extract_tsquery);
@@ -180,7 +198,11 @@ static WordEntryPosVector POSNULL = {
180198
#defineQR_GET_OPERAND(q,v)\
181199
(&((q)->operandData[ ((QueryItem*)(v)) - GETQUERY((q)->query) ]))
182200

201+
#ifPG_VERSION_NUM >=130000
202+
staticTSTernaryValue
203+
#else
183204
staticbool
205+
#endif
184206
pre_checkcondition_rum(void*checkval,QueryOperand*val,ExecPhraseData*data)
185207
{
186208
RumChkVal*gcv= (RumChkVal*)checkval;
@@ -192,9 +214,12 @@ pre_checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
192214

193215
/* convert item's number to corresponding entry's (operand's) number */
194216
j=gcv->map_item_operand[((QueryItem*)val)-gcv->first_item];
195-
196217
/* return presence of current entry in indexed value */
218+
#ifPG_VERSION_NUM >=130000
219+
return (*(gcv->need_recheck) ?TS_MAYBE :gcv->check[j] );
220+
#else
197221
returngcv->check[j];
222+
#endif
198223
}
199224

200225
Datum
@@ -219,10 +244,17 @@ rum_tsquery_pre_consistent(PG_FUNCTION_ARGS)
219244
gcv.map_item_operand= (int*) (extra_data[0]);
220245
gcv.need_recheck=&recheck;
221246

247+
#ifPG_VERSION_NUM >=130000
248+
res=TS_execute(GETQUERY(query),
249+
&gcv,
250+
TS_EXEC_PHRASE_NO_POS |TS_EXEC_SKIP_NOT,
251+
pre_checkcondition_rum);
252+
#else
222253
res=TS_execute(GETQUERY(query),
223254
&gcv,
224255
TS_EXEC_PHRASE_NO_POS,
225256
pre_checkcondition_rum);
257+
#endif
226258
}
227259

228260
PG_RETURN_BOOL(res);
@@ -1466,9 +1498,13 @@ Cover(DocRepresentation *doc, uint32 len, QueryRepresentation *qr,
14661498
}
14671499
}
14681500

1469-
1501+
#ifPG_VERSION_NUM >=130000
1502+
if (TS_execute(GETQUERY(qr->query), (void*)qr,TS_EXEC_SKIP_NOT,
1503+
(TSExecuteCallback)checkcondition_QueryOperand))
1504+
#else
14701505
if (TS_execute(GETQUERY(qr->query), (void*)qr,TS_EXEC_EMPTY,
14711506
checkcondition_QueryOperand))
1507+
#endif
14721508
{
14731509
if (ptr->pos>ext->q)
14741510
{
@@ -1508,8 +1544,13 @@ Cover(DocRepresentation *doc, uint32 len, QueryRepresentation *qr,
15081544
WEP_SETWEIGHT(qro->pos,ptr->wclass);
15091545
}
15101546
}
1547+
#ifPG_VERSION_NUM >=130000
1548+
if (TS_execute(GETQUERY(qr->query), (void*)qr,TS_EXEC_EMPTY,
1549+
(TSExecuteCallback)checkcondition_QueryOperand))
1550+
#else
15111551
if (TS_execute(GETQUERY(qr->query), (void*)qr,TS_EXEC_CALC_NOT,
15121552
checkcondition_QueryOperand))
1553+
#endif
15131554
{
15141555
if (ptr->pos<ext->p)
15151556
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp