aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2003-11-25 13:33:15 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2003-11-25 13:33:15 +0000
commit4ca765f9aa21b2b06834a024499f0fd039385dd8 (patch)
tree929a30de48e4665e37ce3efc831b4f2b97ece873
parentcf87eb47265d251889804178e49b0cd57aa6f298 (diff)
downloadpostgresql-4ca765f9aa21b2b06834a024499f0fd039385dd8.tar.gz
postgresql-4ca765f9aa21b2b06834a024499f0fd039385dd8.zip
Ignore too long lexeme
-rw-r--r--contrib/tsearch2/ts_cfg.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/contrib/tsearch2/ts_cfg.c b/contrib/tsearch2/ts_cfg.c
index 6ff25b2b166..0898b919240 100644
--- a/contrib/tsearch2/ts_cfg.c
+++ b/contrib/tsearch2/ts_cfg.c
@@ -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);