1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Do not fallback to AND for FTS phrase operator.

If there is no positional information of lexemes then phrase operator will not
fallback to AND operator. This change makes needing to modify TS_execute()
interface, because somewhere (in indexes, for example) positional information
is unaccesible and in this cases we need to force fallback to AND.

Per discussion c19fcfec308e6ccd952cdde9e648b505@mail.gmail.com
This commit is contained in:
Teodor Sigaev
2016-06-27 20:47:32 +03:00
parent 028350f619
commit 3dbbd0f02a
7 changed files with 53 additions and 27 deletions

View File

@ -111,8 +111,25 @@ typedef struct ExecPhraseData
WordEntryPos *pos;
} ExecPhraseData;
extern bool TS_execute(QueryItem *curitem, void *checkval, bool calcnot,
/*
* Evaluates tsquery, flags are followe below
*/
extern bool TS_execute(QueryItem *curitem, void *checkval, uint32 flags,
bool (*chkcond) (void *, QueryOperand *, ExecPhraseData *));
#define TS_EXEC_EMPTY (0x00)
/*
* if TS_EXEC_CALC_NOT is not set then NOT expression evaluated to be true,
* used in cases where NOT cannot be accurately computed (GiST) or
* it isn't important (ranking)
*/
#define TS_EXEC_CALC_NOT (0x01)
/*
* Treat OP_PHRASE as OP_AND. Used when posiotional information is not
* accessible, like in consistent methods of GIN/GiST indexes
*/
#define TS_EXEC_PHRASE_AS_AND (0x02)
extern bool tsquery_requires_match(QueryItem *curitem);
/*