1
- /* $PostgreSQL: pgsql/contrib/tsearch2/dict_thesaurus.c,v 1.1 2006/05/31 14:05:31 teodor Exp $ */
1
+ /* $PostgreSQL: pgsql/contrib/tsearch2/dict_thesaurus.c,v 1.2 2006/06/02 15:35:42 teodor Exp $ */
2
2
3
3
/*
4
4
* thesaurus
@@ -330,8 +330,12 @@ compileTheLexeme(DictThesaurus *d) {
330
330
);
331
331
332
332
if ( !(ptr && ptr -> lexeme ) ) {
333
+ if ( !ptr )
334
+ elog (NOTICE ,"Thesaurus: word '%s' isn't recognized by subdictionary" ,d -> wrds [i ].lexeme );
335
+ else
336
+ elog (ERROR ,"Thesaurus: word '%s' is recognized as stop-word, assign any stop-word" ,d -> wrds [i ].lexeme );
337
+
333
338
newwrds = addCompiledLexeme (newwrds ,& nnw ,& tnm ,NULL ,d -> wrds [i ].entries ,0 );
334
- elog (NOTICE ,"Thesaurus: word '%s' isn't recognized by subdictionary or it's a stop-word, assign any non-recognized word" ,d -> wrds [i ].lexeme );
335
339
}else {
336
340
while (ptr -> lexeme ) {
337
341
TSLexeme * remptr = ptr + 1 ;
@@ -420,7 +424,7 @@ compileTheSubstitute(DictThesaurus *d) {
420
424
);
421
425
422
426
reml = lexized ;
423
- if (lexized ) {
427
+ if (lexized && lexized -> lexeme ) {
424
428
int toset = (lexized -> lexeme && outptr != d -> subst [i ].res ) ? (outptr - d -> subst [i ].res ) :-1 ;
425
429
426
430
while (lexized -> lexeme ) {
@@ -443,13 +447,18 @@ compileTheSubstitute(DictThesaurus *d) {
443
447
444
448
if (toset > 0 )
445
449
d -> subst [i ].res [toset ].flags |=TSL_ADDPOS ;
450
+ }else {
451
+ elog (NOTICE ,"Thesaurus: word '%s' isn't recognized by subdictionary or it's a stop-word, ignored" ,inptr -> lexeme );
446
452
}
447
453
448
454
if (inptr -> lexeme )
449
455
free (inptr -> lexeme );
450
456
inptr ++ ;
451
457
}
452
458
459
+ if (outptr == d -> subst [i ].res )
460
+ elog (ERROR ,"Thesaurus: all words in subsitution aren't recognized by subdictionary" );
461
+
453
462
d -> subst [i ].reslen = outptr - d -> subst [i ].res ;
454
463
455
464
free (rem );