|
21 | 21 | #include "common.h"
|
22 | 22 | #include "tsvector.h"
|
23 | 23 |
|
| 24 | +#define IGNORE_LONGLEXEME 1 |
| 25 | + |
24 | 26 | /*********top interface**********/
|
25 | 27 |
|
26 | 28 | static void *plan_getcfg_bylocale = NULL;
|
@@ -288,10 +290,18 @@ parsetext_v2(TSCfgInfo * cfg, PRSTEXT * prs, char *buf, int4 buflen)
|
288 | 290 | PointerGetDatum(&lenlemm)))) != 0)
|
289 | 291 | {
|
290 | 292 |
|
291 |
| - if (lenlemm >= MAXSTRLEN) |
| 293 | + if (lenlemm >= MAXSTRLEN) { |
| 294 | +#ifdef IGNORE_LONGLEXEME |
| 295 | + ereport(NOTICE, |
| 296 | + (errcode(ERRCODE_SYNTAX_ERROR), |
| 297 | + errmsg("word is too long"))); |
| 298 | + continue; |
| 299 | +#else |
292 | 300 | ereport(ERROR,
|
293 | 301 | (errcode(ERRCODE_SYNTAX_ERROR),
|
294 | 302 | errmsg("word is too long")));
|
| 303 | +#endif |
| 304 | + } |
295 | 305 |
|
296 | 306 | if (type >= cfg->len) /* skip this type of lexem */
|
297 | 307 | continue;
|
@@ -414,10 +424,18 @@ hlparsetext(TSCfgInfo * cfg, HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int4
|
414 | 424 | PointerGetDatum(&lenlemm)))) != 0)
|
415 | 425 | {
|
416 | 426 |
|
417 |
| - if (lenlemm >= MAXSTRLEN) |
| 427 | + if (lenlemm >= MAXSTRLEN) { |
| 428 | +#ifdef IGNORE_LONGLEXEME |
| 429 | + ereport(NOTICE, |
| 430 | + (errcode(ERRCODE_SYNTAX_ERROR), |
| 431 | + errmsg("word is too long"))); |
| 432 | + continue; |
| 433 | +#else |
418 | 434 | ereport(ERROR,
|
419 | 435 | (errcode(ERRCODE_SYNTAX_ERROR),
|
420 | 436 | errmsg("word is too long")));
|
| 437 | +#endif |
| 438 | + } |
421 | 439 |
|
422 | 440 | hladdword(prs, lemm, lenlemm, type);
|
423 | 441 |
|
|
0 commit comments