diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/tsearch/ts_parse.c | 13 | ||||
-rw-r--r-- | src/backend/tsearch/wparser_def.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/tsvector_op.c | 3 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/backend/tsearch/ts_parse.c b/src/backend/tsearch/ts_parse.c index 1c0f94e7975..6491f0a7150 100644 --- a/src/backend/tsearch/ts_parse.c +++ b/src/backend/tsearch/ts_parse.c @@ -433,6 +433,8 @@ parsetext(Oid cfgId, ParsedText *prs, char *buf, int buflen) /* * Headline framework */ + +/* Add a word to prs->words[] */ static void hladdword(HeadlineParsedText *prs, char *buf, int buflen, int type) { @@ -449,6 +451,14 @@ hladdword(HeadlineParsedText *prs, char *buf, int buflen, int type) prs->curwords++; } +/* + * Add pos and matching-query-item data to the just-added word. + * Here, buf/buflen represent a processed lexeme, not raw token text. + * + * If the query contains more than one matching item, we replicate + * the last-added word so that each item can be pointed to. The + * duplicate entries are marked with repeated = 1. + */ static void hlfinditem(HeadlineParsedText *prs, TSQuery query, int32 pos, char *buf, int buflen) { @@ -590,6 +600,9 @@ hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query, char *buf, int bu FunctionCall1(&(prsobj->prsend), PointerGetDatum(prsdata)); } +/* + * Generate the headline, as a text object, from HeadlineParsedText. + */ text * generateHeadline(HeadlineParsedText *prs) { diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c index 2915f3b2989..fd5b81279a3 100644 --- a/src/backend/tsearch/wparser_def.c +++ b/src/backend/tsearch/wparser_def.c @@ -1921,10 +1921,6 @@ prsd_end(PG_FUNCTION_ARGS) */ /* token type classification macros */ -#define LEAVETOKEN(x) ( (x)==SPACE ) -#define COMPLEXTOKEN(x) ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD ) -#define ENDPUNCTOKEN(x) ( (x)==SPACE ) - #define TS_IDIGNORE(x) ( (x)==TAG_T || (x)==PROTOCOL || (x)==SPACE || (x)==XMLENTITY ) #define HLIDREPLACE(x) ( (x)==TAG_T ) #define HLIDSKIP(x) ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD ) diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index 69fdd2fe36f..cc3e3c15054 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -1616,6 +1616,9 @@ TS_phrase_execute(QueryItem *curitem, void *arg, uint32 flags, /* since this function recurses, it could be driven to stack overflow */ check_stack_depth(); + /* ... and let's check for query cancel while we're at it */ + CHECK_FOR_INTERRUPTS(); + if (curitem->type == QI_VAL) return chkcond(arg, (QueryOperand *) curitem, data); |