|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $PostgreSQL: pgsql/src/backend/tsearch/dict_thesaurus.c,v 1.5 2007/11/09 01:32:22 momjian Exp $ |
| 10 | + * $PostgreSQL: pgsql/src/backend/tsearch/dict_thesaurus.c,v 1.6 2007/11/10 15:39:34 momjian Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -412,47 +412,48 @@ compileTheLexeme(DictThesaurus * d)
|
412 | 412 | {
|
413 | 413 | TSLexeme *ptr;
|
414 | 414 |
|
415 |
| - ptr = (TSLexeme *) DatumGetPointer(FunctionCall4(&(d->subdict->lexize), |
416 |
| - PointerGetDatum(d->subdict->dictData), |
417 |
| - PointerGetDatum(d->wrds[i].lexeme), |
418 |
| - Int32GetDatum(strlen(d->wrds[i].lexeme)), |
419 |
| - PointerGetDatum(NULL))); |
420 |
| - |
421 |
| - if (!ptr) |
422 |
| - elog(ERROR, "thesaurus word-sample \"%s\" isn't recognized by subdictionary (rule %d)", |
423 |
| - d->wrds[i].lexeme, d->wrds[i].entries->idsubst + 1); |
424 |
| - else if (!(ptr->lexeme)) |
425 |
| - { |
426 |
| - elog(NOTICE, "thesaurus word-sample \"%s\" is recognized as stop-word, assign any stop-word (rule %d)", |
427 |
| - d->wrds[i].lexeme, d->wrds[i].entries->idsubst + 1); |
428 |
| - |
| 415 | + if (strcmp(d->wrds[i].lexeme, "?") == 0) /* Is stop word marker? */ |
429 | 416 | newwrds = addCompiledLexeme(newwrds, &nnw, &tnm, NULL, d->wrds[i].entries, 0);
|
430 |
| - } |
431 | 417 | else
|
432 | 418 | {
|
433 |
| - while (ptr->lexeme) |
| 419 | + ptr = (TSLexeme *) DatumGetPointer(FunctionCall4(&(d->subdict->lexize), |
| 420 | + PointerGetDatum(d->subdict->dictData), |
| 421 | + PointerGetDatum(d->wrds[i].lexeme), |
| 422 | + Int32GetDatum(strlen(d->wrds[i].lexeme)), |
| 423 | + PointerGetDatum(NULL))); |
| 424 | + |
| 425 | + if (!ptr) |
| 426 | + elog(ERROR, "thesaurus word-sample \"%s\" isn't recognized by subdictionary (rule %d)", |
| 427 | + d->wrds[i].lexeme, d->wrds[i].entries->idsubst + 1); |
| 428 | + else if (!(ptr->lexeme)) |
| 429 | + elog(ERROR, "thesaurus word-sample \"%s\" is recognized as stop-word, use \"?\" for stop words instead (rule %d)", |
| 430 | + d->wrds[i].lexeme, d->wrds[i].entries->idsubst + 1); |
| 431 | + else |
434 | 432 | {
|
435 |
| - TSLexeme *remptr = ptr + 1; |
436 |
| - int tnvar = 1; |
437 |
| - int curvar = ptr->nvariant; |
438 |
| - |
439 |
| - /* compute n words in one variant */ |
440 |
| - while (remptr->lexeme) |
| 433 | + while (ptr->lexeme) |
441 | 434 | {
|
442 |
| - if (remptr->nvariant != (remptr - 1)->nvariant) |
443 |
| - break; |
444 |
| - tnvar++; |
445 |
| - remptr++; |
446 |
| - } |
447 |
| - |
448 |
| - remptr = ptr; |
449 |
| - while (remptr->lexeme && remptr->nvariant == curvar) |
450 |
| - { |
451 |
| - newwrds = addCompiledLexeme(newwrds, &nnw, &tnm, remptr, d->wrds[i].entries, tnvar); |
452 |
| - remptr++; |
| 435 | + TSLexeme *remptr = ptr + 1; |
| 436 | + int tnvar = 1; |
| 437 | + int curvar = ptr->nvariant; |
| 438 | + |
| 439 | + /* compute n words in one variant */ |
| 440 | + while (remptr->lexeme) |
| 441 | + { |
| 442 | + if (remptr->nvariant != (remptr - 1)->nvariant) |
| 443 | + break; |
| 444 | + tnvar++; |
| 445 | + remptr++; |
| 446 | + } |
| 447 | + |
| 448 | + remptr = ptr; |
| 449 | + while (remptr->lexeme && remptr->nvariant == curvar) |
| 450 | + { |
| 451 | + newwrds = addCompiledLexeme(newwrds, &nnw, &tnm, remptr, d->wrds[i].entries, tnvar); |
| 452 | + remptr++; |
| 453 | + } |
| 454 | + |
| 455 | + ptr = remptr; |
453 | 456 | }
|
454 |
| - |
455 |
| - ptr = remptr; |
456 | 457 | }
|
457 | 458 | }
|
458 | 459 |
|
|
0 commit comments