@@ -600,6 +600,14 @@ rum_phrase_execute(QueryItem *curitem, void *arg, uint32 flags,
600
600
601
601
if (curitem -> qoperator .oper == OP_PHRASE )
602
602
{
603
+ /* In case of index where position is not available
604
+ * (e.g. addon_ops) output TS_MAYBE even in case both
605
+ * lmatch and rmatch are TS_YES. Otherwise we can lose
606
+ * results of phrase queries.
607
+ */
608
+ if (flags & TS_EXEC_PHRASE_NO_POS )
609
+ return TS_MAYBE ;
610
+
603
611
/*
604
612
* Compute Loffset and Roffset suitable for phrase match, and
605
613
* compute overall width of whole phrase match.
@@ -829,13 +837,10 @@ rum_TS_execute(QueryItem *curitem, void *arg, uint32 flags,
829
837
case OP_PHRASE :
830
838
831
839
/*
832
- * If we get a MAYBE result, and the caller doesn't want that,
833
- * convert it to NO. It would be more consistent, perhaps, to
834
- * return the result of TS_phrase_execute() verbatim and then
835
- * convert MAYBE results at the top of the recursion. But
836
- * converting at the topmost phrase operator gives results that
837
- * are bug-compatible with the old implementation, so do it like
838
- * this for now.
840
+ * Checking for TS_EXEC_PHRASE_NO_POS has been moved inside
841
+ * rum_phrase_execute, otherwise we can lose results of phrase
842
+ * operator when position information is not available in index
843
+ * (e.g. index built with addon_ops)
839
844
*/
840
845
switch (rum_phrase_execute (curitem , arg , flags , chkcond , NULL ))
841
846
{
@@ -844,7 +849,7 @@ rum_TS_execute(QueryItem *curitem, void *arg, uint32 flags,
844
849
case TS_YES :
845
850
return TS_YES ;
846
851
case TS_MAYBE :
847
- return ( flags & TS_EXEC_PHRASE_NO_POS ) ? TS_MAYBE : TS_NO ;
852
+ return TS_MAYBE ;
848
853
}
849
854
break ;
850
855
0 commit comments