PostgreSQL Source Code
git master
|
Go to the source code of this file.
Data Structures | |
struct | ParsedWord |
struct | ParsedText |
struct | ExecPhraseData |
struct | QTNode |
Macros | |
#define | P_TSV_OPR_IS_DELIM (1 << 0) |
#define | P_TSV_IS_TSQUERY (1 << 1) |
#define | P_TSV_IS_WEB (1 << 2) |
#define | ISOPERATOR(x) |
#define | P_TSQ_PLAIN (1 << 0) |
#define | P_TSQ_WEB (1 << 1) |
#define | TS_EXEC_EMPTY (0x00) |
#define | TS_EXEC_SKIP_NOT (0x01) |
#define | TS_EXEC_PHRASE_NO_POS (0x02) |
#define | TSearchStrategyNumber 1 |
#define | TSearchWithClassStrategyNumber 2 |
#define | QTN_NEEDFREE 0x01 |
#define | QTN_NOCHANGE 0x02 |
#define | QTN_WORDFREE 0x04 |
#define | TSQS_SIGLEN (sizeof(TSQuerySign)*BITS_PER_BYTE) |
#define | PG_RETURN_TSQUERYSIGN(X) return TSQuerySignGetDatum(X) |
#define | PG_GETARG_TSQUERYSIGN(n) DatumGetTSQuerySign(PG_GETARG_DATUM(n)) |
Typedefs | |
typedef struct TSVectorParseStateData * | TSVectorParseState |
typedef struct TSQueryParserStateData * | TSQueryParserState |
typedef void(* | PushFunction) (Datum opaque, TSQueryParserState state, char *token, int tokenlen, int16 tokenweights, bool prefix) |
typedef struct ExecPhraseData | ExecPhraseData |
typedef TSTernaryValue(* | TSExecuteCallback) (void *arg, QueryOperand *val, ExecPhraseData *data) |
typedef struct QTNode | QTNode |
typedef uint64 | TSQuerySign |
Enumerations | |
enum | TSTernaryValue { TS_NO , TS_YES , TS_MAYBE } |
#define ISOPERATOR | ( | x | ) |
#define P_TSQ_PLAIN (1 << 0) |
Definition at line 64 of file ts_utils.h.
#define P_TSQ_WEB (1 << 1) |
Definition at line 65 of file ts_utils.h.
#define P_TSV_IS_TSQUERY (1 << 1) |
Definition at line 30 of file ts_utils.h.
#define P_TSV_IS_WEB (1 << 2) |
Definition at line 31 of file ts_utils.h.
#define P_TSV_OPR_IS_DELIM (1 << 0) |
Definition at line 29 of file ts_utils.h.
#define PG_GETARG_TSQUERYSIGN | ( | n | ) | DatumGetTSQuerySign(PG_GETARG_DATUM(n)) |
Definition at line 266 of file ts_utils.h.
#define PG_RETURN_TSQUERYSIGN | ( | X | ) | return TSQuerySignGetDatum(X) |
Definition at line 265 of file ts_utils.h.
#define QTN_NEEDFREE 0x01 |
Definition at line 245 of file ts_utils.h.
#define QTN_NOCHANGE 0x02 |
Definition at line 246 of file ts_utils.h.
#define QTN_WORDFREE 0x04 |
Definition at line 247 of file ts_utils.h.
#define TS_EXEC_EMPTY (0x00) |
Definition at line 188 of file ts_utils.h.
#define TS_EXEC_PHRASE_NO_POS (0x02) |
Definition at line 202 of file ts_utils.h.
#define TS_EXEC_SKIP_NOT (0x01) |
Definition at line 195 of file ts_utils.h.
#define TSearchStrategyNumber 1 |
Definition at line 225 of file ts_utils.h.
#define TSearchWithClassStrategyNumber 2 |
Definition at line 226 of file ts_utils.h.
#define TSQS_SIGLEN (sizeof(TSQuerySign)*BITS_PER_BYTE) |
Definition at line 251 of file ts_utils.h.
typedef struct ExecPhraseData ExecPhraseData |
typedef void(* PushFunction) (Datum opaque, TSQueryParserState state, char *token, int tokenlen, int16 tokenweights, bool prefix) |
Definition at line 57 of file ts_utils.h.
typedef TSTernaryValue(* TSExecuteCallback) (void *arg, QueryOperand *val, ExecPhraseData *data) |
Definition at line 182 of file ts_utils.h.
typedef struct TSQueryParserStateData* TSQueryParserState |
Definition at line 55 of file ts_utils.h.
typedef uint64 TSQuerySign |
Definition at line 249 of file ts_utils.h.
typedef struct TSVectorParseStateData* TSVectorParseState |
Definition at line 26 of file ts_utils.h.
enum TSTernaryValue |
Definition at line 387 of file tsquery_cleanup.c.
References calcstrlen(), clean_stopword_intree(), COMPUTESIZE, QueryOperand::distance, ereport, errmsg(), GETOPERAND, GETQUERY, HDRSIZETQ, i, items, len, QueryOperand::length, maketree(), NOTICE, palloc(), plaintree(), QI_VAL, root, SET_VARSIZE, TSQueryData::size, and QueryOperand::type.
Referenced by parse_tsquery().
void close_tsvector_parser | ( | TSVectorParseState | state | ) |
Definition at line 90 of file tsvector_parser.c.
References pfree().
Referenced by parse_tsquery(), and tsvectorin().
|
inlinestatic |
Definition at line 260 of file ts_utils.h.
References DatumGetInt64().
Referenced by gtsquery_consistent(), and gtsquery_penalty().
Definition at line 267 of file tsquery_rewrite.c.
References dofindsubquery(), and root.
Referenced by tsquery_rewrite(), and tsquery_rewrite_query().
text* generateHeadline | ( | HeadlineParsedText * | prs | ) |
Definition at line 607 of file ts_parse.c.
References HeadlineParsedText::curwords, HeadlineParsedText::fragdelim, HeadlineParsedText::fragdelimlen, HeadlineWordEntry::in, HeadlineWordEntry::len, len, palloc(), pfree(), repalloc(), HeadlineWordEntry::repeated, HeadlineWordEntry::replace, HeadlineWordEntry::selected, SET_VARSIZE, HeadlineWordEntry::skip, HeadlineParsedText::startsel, HeadlineParsedText::startsellen, HeadlineParsedText::stopsel, HeadlineParsedText::stopsellen, VARHDRSZ, HeadlineWordEntry::word, and HeadlineParsedText::words.
Referenced by headline_json_value(), and ts_headline_byid_opt().
bool gettoken_tsvector | ( | TSVectorParseState | state, |
char ** | strval, | ||
int * | lenval, | ||
WordEntryPos ** | pos_ptr, | ||
int * | poslen, | ||
char ** | endptr | ||
) |
Definition at line 176 of file tsvector_parser.c.
References Assert, COPYCHAR, elog, ereturn, errcode(), errmsg(), ERROR, INPOSINFO, ISOPERATOR, LIMITPOS, palloc(), pg_mblen(), PRSSYNTAXERROR, repalloc(), RESIZEPRSBUF, RETURN_TOKEN, t_isdigit(), t_iseq, t_isspace(), WAITCHARCMPLX, WAITENDCMPLX, WAITENDWORD, WAITNEXTCHAR, WAITPOSDELIM, WAITPOSINFO, WAITWORD, WEP_GETPOS, WEP_GETWEIGHT, WEP_SETPOS, and WEP_SETWEIGHT.
Referenced by gettoken_query_standard(), gettoken_query_websearch(), and tsvectorin().
void hlparsetext | ( | Oid | cfgId, |
HeadlineParsedText * | prs, | ||
TSQuery | query, | ||
char * | buf, | ||
int32 | buflen | ||
) |
TSVectorParseState init_tsvector_parser | ( | char * | input, |
int | flags, | ||
Node * | escontext | ||
) |
Definition at line 57 of file tsvector_parser.c.
References input, P_TSV_IS_TSQUERY, P_TSV_IS_WEB, P_TSV_OPR_IS_DELIM, palloc(), and pg_database_encoding_max_length().
Referenced by parse_tsquery(), and tsvectorin().
TSVector make_tsvector | ( | ParsedText * | prs | ) |
Definition at line 165 of file to_tsany.c.
References ParsedWord::alen, ARRPTR, CALCDATASIZE, ParsedText::curwords, elog, ereport, errcode(), errmsg(), ERROR, WordEntry::haspos, i, j, WordEntry::len, ParsedWord::len, MAXSTRPOS, palloc0(), pfree(), WordEntry::pos, ParsedWord::pos, POSDATAPTR, SET_VARSIZE, SHORTALIGN, TSVectorData::size, str, STRPTR, uniqueWORD(), WEP_SETPOS, WEP_SETWEIGHT, ParsedWord::word, and ParsedText::words.
Referenced by json_to_tsvector_worker(), jsonb_to_tsvector_worker(), to_tsvector_byid(), and tsvector_update_trigger().
TSQuerySign makeTSQuerySign | ( | TSQuery | a | ) |
Definition at line 250 of file tsquery_op.c.
References a, GETQUERY, i, QI_VAL, QueryItem::qoperand, sign, TSQS_SIGLEN, QueryItem::type, and QueryOperand::valcrc.
Referenced by gtsquery_compress(), and gtsquery_consistent().
TSQuery parse_tsquery | ( | char * | buf, |
PushFunction | pushval, | ||
Datum | opaque, | ||
int | flags, | ||
Node * | escontext | ||
) |
Definition at line 817 of file tsquery.c.
References Assert, buf, cleanup_tsquery_stopwords(), close_tsvector_parser(), COMPUTESIZE, elog, ereport, ereturn, errcode(), errmsg(), ERROR, TSQueryParserStateData::escontext, findoprnd(), GETOPERAND, GETQUERY, gettoken_query_plain(), gettoken_query_standard(), gettoken_query_websearch(), HDRSIZETQ, i, init_tsvector_parser(), IsA, lfirst, list_length(), makepol(), NIL, NOTICE, P_TSQ_PLAIN, P_TSQ_WEB, P_TSV_IS_TSQUERY, P_TSV_IS_WEB, P_TSV_OPR_IS_DELIM, palloc(), palloc0(), pfree(), QI_OPR, QI_VAL, QI_VALSTOP, SET_VARSIZE, TSQueryData::size, SOFT_ERROR_OCCURRED, TSQUERY_TOO_BIG, QueryItem::type, and WAITFIRSTOPERAND.
Referenced by phraseto_tsquery_byid(), plainto_tsquery_byid(), to_tsquery_byid(), tsqueryin(), and websearch_to_tsquery_byid().
void parsetext | ( | Oid | cfgId, |
ParsedText * | prs, | ||
char * | buf, | ||
int32 | buflen | ||
) |
void pushOperator | ( | TSQueryParserState | state, |
int8 | oper, | ||
int16 | distance | ||
) |
Definition at line 531 of file tsquery.c.
References Assert, QueryOperator::distance, lcons(), OP_AND, OP_NOT, OP_OR, OP_PHRASE, oper(), QueryOperator::oper, palloc0(), QI_OPR, and QueryOperator::type.
Referenced by cleanOpStack(), and pushval_morph().
void pushStop | ( | TSQueryParserState | state | ) |
Definition at line 616 of file tsquery.c.
References lcons(), palloc0(), QI_VALSTOP, and QueryOperand::type.
Referenced by gettoken_query_websearch(), and pushval_morph().
void pushValue | ( | TSQueryParserState | state, |
char * | strval, | ||
int | lenval, | ||
int16 | weight, | ||
bool | prefix | ||
) |
Definition at line 580 of file tsquery.c.
References COMP_LEGACY_CRC32, ereturn, errcode(), errmsg(), FIN_LEGACY_CRC32, INIT_LEGACY_CRC32, MAXSTRLEN, pushValue_internal(), and repalloc().
Referenced by pushval_asis(), and pushval_morph().
Definition at line 25 of file tsquery_util.c.
References check_stack_depth(), QTNode::child, QueryOperand::distance, QueryOperator::left, QTNode::nchild, OP_NOT, QueryOperator::oper, palloc0(), QI_OPR, QueryItem::qoperand, QueryItem::qoperator, QTNode::sign, QueryItem::type, QueryOperand::valcrc, QTNode::valnode, and QTNode::word.
Referenced by CompareTSQ(), join_tsqueries(), tsquery_not(), tsquery_rewrite(), and tsquery_rewrite_query().
Definition at line 363 of file tsquery_util.c.
References cntsize(), COMPUTESIZE, ereport, errcode(), errmsg(), ERROR, fillQT(), GETOPERAND, GETQUERY, len, palloc0(), SET_VARSIZE, TSQueryData::size, and TSQUERY_TOO_BIG.
Referenced by tsquery_and(), tsquery_not(), tsquery_or(), tsquery_phrase_distance(), tsquery_rewrite(), and tsquery_rewrite_query().
void QTNBinary | ( | QTNode * | in | ) |
Definition at line 250 of file tsquery_util.c.
References check_stack_depth(), QTNode::child, QTNode::flags, i, QTNode::nchild, QueryOperator::oper, palloc0(), QI_OPR, QueryItem::qoperator, QTN_NEEDFREE, QTNode::sign, QueryItem::type, and QTNode::valnode.
Referenced by tsquery_rewrite(), and tsquery_rewrite_query().
Definition at line 434 of file tsquery_util.c.
References check_stack_depth(), QTNode::child, QTNode::flags, i, QTNode::nchild, QI_VAL, QueryItem::type, and QTNode::valnode.
Referenced by tsquery_rewrite_query().
Definition at line 396 of file tsquery_util.c.
References check_stack_depth(), QTNode::child, QTNode::flags, i, QueryOperand::length, QTNode::nchild, palloc(), QI_VAL, QueryItem::qoperand, QTN_NEEDFREE, QTN_WORDFREE, QueryItem::type, QTNode::valnode, and QTNode::word.
Referenced by findeq().
Definition at line 183 of file tsquery_util.c.
References a, b, QTNodeCompare(), and sign.
Referenced by findeq().
void QTNFree | ( | QTNode * | in | ) |
Definition at line 64 of file tsquery_util.c.
References check_stack_depth(), QTNode::child, QTNode::flags, i, QTNode::nchild, pfree(), QI_OPR, QI_VAL, QTN_NEEDFREE, QTN_WORDFREE, QueryItem::type, QTNode::valnode, and QTNode::word.
Referenced by CompareTSQ(), dofindsubquery(), findeq(), tsquery_and(), tsquery_not(), tsquery_or(), tsquery_phrase_distance(), tsquery_rewrite(), and tsquery_rewrite_query().
Definition at line 97 of file tsquery_util.c.
References check_stack_depth(), QTNode::child, QueryOperator::distance, elog, ERROR, i, QueryOperand::length, QTNode::nchild, OP_PHRASE, QueryOperator::oper, QI_OPR, QI_VAL, QueryItem::qoperand, QueryItem::qoperator, res, tsCompareString(), QueryItem::type, QueryOperand::valcrc, QTNode::valnode, and QTNode::word.
Referenced by cmpQTN(), CompareTSQ(), findeq(), and QTNEq().
void QTNSort | ( | QTNode * | in | ) |
Definition at line 163 of file tsquery_util.c.
References check_stack_depth(), QTNode::child, cmpQTN(), i, QTNode::nchild, OP_PHRASE, QueryOperator::oper, QI_OPR, QueryItem::qoperator, qsort, QueryItem::type, and QTNode::valnode.
Referenced by findeq(), tsquery_rewrite(), and tsquery_rewrite_query().
void QTNTernary | ( | QTNode * | in | ) |
Definition at line 201 of file tsquery_util.c.
References check_stack_depth(), QTNode::child, QTNode::flags, i, QTNode::nchild, OP_AND, OP_OR, QueryOperator::oper, pfree(), QI_OPR, QueryItem::qoperator, QTN_NEEDFREE, repalloc(), QueryItem::type, and QTNode::valnode.
Referenced by tsquery_rewrite(), and tsquery_rewrite_query().
void reset_tsvector_parser | ( | TSVectorParseState | state, |
char * | input | ||
) |
Definition at line 81 of file tsvector_parser.c.
References input.
Referenced by gettoken_query_standard(), and gettoken_query_websearch().
bool TS_execute | ( | QueryItem * | curitem, |
void * | arg, | ||
uint32 | flags, | ||
TSExecuteCallback | chkcond | ||
) |
Definition at line 1854 of file tsvector_op.c.
References arg, TS_execute_recurse(), and TS_NO.
Referenced by Cover(), gtsvector_consistent(), hlCover(), and ts_match_vq().
List* TS_execute_locations | ( | QueryItem * | curitem, |
void * | arg, | ||
uint32 | flags, | ||
TSExecuteCallback | chkcond | ||
) |
Definition at line 2007 of file tsvector_op.c.
References arg, Assert, NIL, TS_EXEC_EMPTY, and TS_execute_locations_recurse().
Referenced by prsd_headline().
TSTernaryValue TS_execute_ternary | ( | QueryItem * | curitem, |
void * | arg, | ||
uint32 | flags, | ||
TSExecuteCallback | chkcond | ||
) |
Definition at line 1871 of file tsvector_op.c.
References arg, and TS_execute_recurse().
Referenced by gin_tsquery_consistent(), and gin_tsquery_triconsistent().
Definition at line 1152 of file tsvector_op.c.
References a, b, cmp(), and Min.
Referenced by checkcondition_str(), compare_text_lexemes(), compareentry(), compareQueryOperand(), compareWORD(), gin_cmp_prefix(), gin_cmp_tslexeme(), hlfinditem(), QTNodeCompare(), silly_cmp_tsvector(), and tsvector_bsearch().
Definition at line 2156 of file tsvector_op.c.
References check_stack_depth(), elog, ERROR, QueryOperator::left, OP_AND, OP_NOT, OP_OR, OP_PHRASE, QueryOperator::oper, QI_VAL, QueryItem::qoperator, and QueryItem::type.
Referenced by gin_extract_tsquery().
|
inlinestatic |
Definition at line 254 of file ts_utils.h.
References Int64GetDatum().
Referenced by gtsquery_compress(), and gtsquery_picksplit().