Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4ca765f

Browse files
committed
Ignore too long lexeme
1 parentcf87eb4 commit4ca765f

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

‎contrib/tsearch2/ts_cfg.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include"common.h"
2222
#include"tsvector.h"
2323

24+
#defineIGNORE_LONGLEXEME1
25+
2426
/*********top interface**********/
2527

2628
staticvoid*plan_getcfg_bylocale=NULL;
@@ -288,10 +290,18 @@ parsetext_v2(TSCfgInfo * cfg, PRSTEXT * prs, char *buf, int4 buflen)
288290
PointerGetDatum(&lenlemm))))!=0)
289291
{
290292

291-
if (lenlemm >=MAXSTRLEN)
293+
if (lenlemm >=MAXSTRLEN) {
294+
#ifdefIGNORE_LONGLEXEME
295+
ereport(NOTICE,
296+
(errcode(ERRCODE_SYNTAX_ERROR),
297+
errmsg("word is too long")));
298+
continue;
299+
#else
292300
ereport(ERROR,
293301
(errcode(ERRCODE_SYNTAX_ERROR),
294302
errmsg("word is too long")));
303+
#endif
304+
}
295305

296306
if (type >=cfg->len)/* skip this type of lexem */
297307
continue;
@@ -414,10 +424,18 @@ hlparsetext(TSCfgInfo * cfg, HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int4
414424
PointerGetDatum(&lenlemm))))!=0)
415425
{
416426

417-
if (lenlemm >=MAXSTRLEN)
427+
if (lenlemm >=MAXSTRLEN) {
428+
#ifdefIGNORE_LONGLEXEME
429+
ereport(NOTICE,
430+
(errcode(ERRCODE_SYNTAX_ERROR),
431+
errmsg("word is too long")));
432+
continue;
433+
#else
418434
ereport(ERROR,
419435
(errcode(ERRCODE_SYNTAX_ERROR),
420436
errmsg("word is too long")));
437+
#endif
438+
}
421439

422440
hladdword(prs,lemm,lenlemm,type);
423441

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp