mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
Ignore too long lexeme
This commit is contained in:
parent
cf87eb4726
commit
4ca765f9aa
@ -21,6 +21,8 @@
|
||||
#include "common.h"
|
||||
#include "tsvector.h"
|
||||
|
||||
#define IGNORE_LONGLEXEME 1
|
||||
|
||||
/*********top interface**********/
|
||||
|
||||
static void *plan_getcfg_bylocale = NULL;
|
||||
@ -288,10 +290,18 @@ parsetext_v2(TSCfgInfo * cfg, PRSTEXT * prs, char *buf, int4 buflen)
|
||||
PointerGetDatum(&lenlemm)))) != 0)
|
||||
{
|
||||
|
||||
if (lenlemm >= MAXSTRLEN)
|
||||
if (lenlemm >= MAXSTRLEN) {
|
||||
#ifdef IGNORE_LONGLEXEME
|
||||
ereport(NOTICE,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("word is too long")));
|
||||
continue;
|
||||
#else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("word is too long")));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (type >= cfg->len) /* skip this type of lexem */
|
||||
continue;
|
||||
@ -414,10 +424,18 @@ hlparsetext(TSCfgInfo * cfg, HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int4
|
||||
PointerGetDatum(&lenlemm)))) != 0)
|
||||
{
|
||||
|
||||
if (lenlemm >= MAXSTRLEN)
|
||||
if (lenlemm >= MAXSTRLEN) {
|
||||
#ifdef IGNORE_LONGLEXEME
|
||||
ereport(NOTICE,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("word is too long")));
|
||||
continue;
|
||||
#else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("word is too long")));
|
||||
#endif
|
||||
}
|
||||
|
||||
hladdword(prs, lemm, lenlemm, type);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user