@@ -42,7 +42,7 @@ typedef struct
4242bool * need_recheck ;
4343Datum * addInfo ;
4444bool * addInfoIsNull ;
45- bool notPhrase ;
45+ bool recheckPhrase ;
4646}RumChkVal ;
4747
4848typedef struct
@@ -176,29 +176,39 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
176176/*
177177 * Fill position list for phrase operator if it's needed end it exists
178178 */
179- if (data && gcv -> addInfo && gcv -> addInfoIsNull [ j ] == false )
179+ if (data )
180180{
181- bytea * positions ;
182- int32 i ;
183- char * ptrt ;
184- WordEntryPos post ;
181+ /* caller wants an array of positions (phrase search) */
185182
186- if (gcv -> notPhrase )
187- elog (ERROR ,"phrase search isn't supported yet" );
183+ if (gcv -> recheckPhrase )
184+ {
185+ /*
186+ * we don't have a positions because we store a timestamp in
187+ * addInfo
188+ */
189+ * (gcv -> need_recheck )= true;
190+ }
191+ else if (gcv -> addInfo && gcv -> addInfoIsNull [j ]== false)
192+ {
193+ bytea * positions ;
194+ int32 i ;
195+ char * ptrt ;
196+ WordEntryPos post ;
188197
189- positions = DatumGetByteaP (gcv -> addInfo [j ]);
190- data -> npos = count_pos (VARDATA_ANY (positions ),
191- VARSIZE_ANY_EXHDR (positions ));
192- data -> pos = palloc (sizeof (* data -> pos )* data -> npos );
193- data -> allocated = true;
198+ positions = DatumGetByteaP (gcv -> addInfo [j ]);
199+ data -> npos = count_pos (VARDATA_ANY (positions ),
200+ VARSIZE_ANY_EXHDR (positions ));
201+ data -> pos = palloc (sizeof (* data -> pos )* data -> npos );
202+ data -> allocated = true;
194203
195- ptrt = (char * )VARDATA_ANY (positions );
196- post = 0 ;
204+ ptrt = (char * )VARDATA_ANY (positions );
205+ post = 0 ;
197206
198- for (i = 0 ;i < data -> npos ;i ++ )
199- {
200- ptrt = decompress_pos (ptrt ,& post );
201- data -> pos [i ]= post ;
207+ for (i = 0 ;i < data -> npos ;i ++ )
208+ {
209+ ptrt = decompress_pos (ptrt ,& post );
210+ data -> pos [i ]= post ;
211+ }
202212}
203213}
204214
@@ -240,9 +250,9 @@ rum_tsquery_consistent(PG_FUNCTION_ARGS)
240250gcv .need_recheck = recheck ;
241251gcv .addInfo = addInfo ;
242252gcv .addInfoIsNull = addInfoIsNull ;
243- gcv .notPhrase = false;
253+ gcv .recheckPhrase = false;
244254
245- res = TS_execute (GETQUERY (query ),& gcv ,true ,checkcondition_rum );
255+ res = TS_execute (GETQUERY (query ),& gcv ,TS_EXEC_EMPTY ,checkcondition_rum );
246256}
247257
248258PG_RETURN_BOOL (res );
@@ -283,9 +293,9 @@ rum_tsquery_timestamp_consistent(PG_FUNCTION_ARGS)
283293gcv .need_recheck = recheck ;
284294gcv .addInfo = addInfo ;
285295gcv .addInfoIsNull = addInfoIsNull ;
286- gcv .notPhrase = true;
296+ gcv .recheckPhrase = true;
287297
288- res = TS_execute (GETQUERY (query ),& gcv ,true ,checkcondition_rum );
298+ res = TS_execute (GETQUERY (query ),& gcv ,TS_EXEC_PHRASE_AS_AND ,checkcondition_rum );
289299}
290300
291301PG_RETURN_BOOL (res );