/* flag bits that can be passed to init_tsvector_parser: */ #define P_TSV_OPR_IS_DELIM (1 << 0) #define P_TSV_IS_TSQUERY (1 << 1) #define P_TSV_IS_WEB (1 << 2)
extern TSVectorParseState init_tsvector_parser(char *input, int flags,
Node *escontext); externvoid reset_tsvector_parser(TSVectorParseState state, char *input); externbool gettoken_tsvector(TSVectorParseState state, char **strval, int *lenval,
WordEntryPos **pos_ptr, int *poslen, char **endptr); externvoid close_tsvector_parser(TSVectorParseState state);
/* TS_execute requires ternary logic to handle NOT with phrase matches */ typedefenum
{
TS_NO, /* definitely no match */
TS_YES, /* definitely does match */
TS_MAYBE, /* can't verify match for lack of pos data */
} TSTernaryValue;
/* *structExecPhraseDataispassedtoaTSExecuteCallbackfunctionifweneed *lexemepositiondata(becauseofaphrase-matchoperatorinthetsquery). *ThecallbackshouldfillinpositiondatawhenitreturnsTS_YES(success). *Ifitcannotreturnpositiondata,itshouldleave"data"unchangedand *returnTS_MAYBE.ThecallerofTS_execute()mustthenarrangeforalater *recheckwithpositiondataavailable. * *Thereportedlexemepositionsmustbesortedandunique.Callersmustonly *consultthepositionbitsoftheposarray,ie,WEP_GETPOS(data->pos[i]). *Thisallowsthereturned"pos"topointdirectlytotheWordEntryPos *portionofatsvectorvalue.If"allocated"istruethentheposarray *ispalloc'dworkspaceandcallermayfreeitwhendone. * *"negate"meansthattheposarraycontainspositionswherethequerydoes *notmatch,ratherthanpositionswhereitdoes."width"ispositivewhen *thematchiswiderthanonelexeme.Neitherofthesefieldsnormallyneed *tobetouchedbyTSExecuteCallbackfunctions;theyareusedfor *phrase-searchprocessingwithinTS_execute. * *AllfieldsoftheExecPhraseDatastructareinitiallyzeroedbycaller.
*/ typedefstruct ExecPhraseData
{ int npos; /* number of positions reported */ bool allocated; /* pos points to palloc'd data? */ bool negate; /* positions are where query is NOT matched */
WordEntryPos *pos; /* ordered, non-duplicate lexeme positions */ int width; /* width of match in lexemes, less 1 */
} ExecPhraseData;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.