12 #ifndef _PG_TS_UTILS_H_
13 #define _PG_TS_UTILS_H_
29 #define P_TSV_OPR_IS_DELIM (1 << 0)
30 #define P_TSV_IS_TSQUERY (1 << 1)
31 #define P_TSV_IS_WEB (1 << 2)
37 char **strval,
int *lenval,
43 #define ISOPERATOR(x) \
44 ( pg_mblen(x) == 1 && ( *(x) == '!' || \
58 char *
token,
int tokenlen,
64 #define P_TSQ_PLAIN (1 << 0)
65 #define P_TSQ_WEB (1 << 1)
75 char *strval,
int lenval,
int16 weight,
bool prefix);
188 #define TS_EXEC_EMPTY (0x00)
195 #define TS_EXEC_SKIP_NOT (0x01)
202 #define TS_EXEC_PHRASE_NO_POS (0x02)
225 #define TSearchStrategyNumber 1
226 #define TSearchWithClassStrategyNumber 2
245 #define QTN_NEEDFREE 0x01
246 #define QTN_NOCHANGE 0x02
247 #define QTN_WORDFREE 0x04
251 #define TSQS_SIGLEN (sizeof(TSQuerySign)*BITS_PER_BYTE)
265 #define PG_RETURN_TSQUERYSIGN(X) return TSQuerySignGetDatum(X)
266 #define PG_GETARG_TSQUERYSIGN(n) DatumGetTSQuerySign(PG_GETARG_DATUM(n))
Datum Int64GetDatum(int64 X)
Operator oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId, bool noError, int location)
static int64 DatumGetInt64(Datum X)
void reset_tsvector_parser(TSVectorParseState state, char *input)
void QTNClearFlags(QTNode *in, uint32 flags)
int QTNodeCompare(QTNode *an, QTNode *bn)
struct ExecPhraseData ExecPhraseData
QTNode * QTNCopy(QTNode *in)
void pushValue(TSQueryParserState state, char *strval, int lenval, int16 weight, bool prefix)
bool TS_execute(QueryItem *curitem, void *arg, uint32 flags, TSExecuteCallback chkcond)
QTNode * QT2QTN(QueryItem *in, char *operand)
void close_tsvector_parser(TSVectorParseState state)
struct TSVectorParseStateData * TSVectorParseState
static Datum TSQuerySignGetDatum(TSQuerySign X)
TSQuerySign makeTSQuerySign(TSQuery a)
void parsetext(Oid cfgId, ParsedText *prs, char *buf, int32 buflen)
TSQuery parse_tsquery(char *buf, PushFunction pushval, Datum opaque, int flags, Node *escontext)
void pushOperator(TSQueryParserState state, int8 oper, int16 distance)
TSQuery cleanup_tsquery_stopwords(TSQuery in, bool noisy)
void QTNTernary(QTNode *in)
int32 tsCompareString(char *a, int lena, char *b, int lenb, bool prefix)
static TSQuerySign DatumGetTSQuerySign(Datum X)
QTNode * findsubquery(QTNode *root, QTNode *ex, QTNode *subs, bool *isfind)
void hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query, char *buf, int32 buflen)
text * generateHeadline(HeadlineParsedText *prs)
bool tsquery_requires_match(QueryItem *curitem)
QueryItem * clean_NOT(QueryItem *ptr, int32 *len)
TSVector make_tsvector(ParsedText *prs)
bool gettoken_tsvector(TSVectorParseState state, char **strval, int *lenval, WordEntryPos **pos_ptr, int *poslen, char **endptr)
bool QTNEq(QTNode *a, QTNode *b)
TSTernaryValue TS_execute_ternary(QueryItem *curitem, void *arg, uint32 flags, TSExecuteCallback chkcond)
TSVectorParseState init_tsvector_parser(char *input, int flags, Node *escontext)
struct TSQueryParserStateData * TSQueryParserState
void pushStop(TSQueryParserState state)
TSQuery QTN2QT(QTNode *in)
TSTernaryValue(* TSExecuteCallback)(void *arg, QueryOperand *val, ExecPhraseData *data)
void QTNBinary(QTNode *in)
List * TS_execute_locations(QueryItem *curitem, void *arg, uint32 flags, TSExecuteCallback chkcond)
void(* PushFunction)(Datum opaque, TSQueryParserState state, char *token, int tokenlen, int16 tokenweights, bool prefix)