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 $ */
22
33/*
44 * thesaurus
@@ -330,8 +330,12 @@ compileTheLexeme(DictThesaurus *d) {
330330);
331331
332332if ( !(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+
333338newwrds = 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 );
335339}else {
336340while (ptr -> lexeme ) {
337341TSLexeme * remptr = ptr + 1 ;
@@ -420,7 +424,7 @@ compileTheSubstitute(DictThesaurus *d) {
420424);
421425
422426reml = lexized ;
423- if (lexized ) {
427+ if (lexized && lexized -> lexeme ) {
424428int toset = (lexized -> lexeme && outptr != d -> subst [i ].res ) ? (outptr - d -> subst [i ].res ) :-1 ;
425429
426430while (lexized -> lexeme ) {
@@ -443,13 +447,18 @@ compileTheSubstitute(DictThesaurus *d) {
443447
444448if (toset > 0 )
445449d -> 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 );
446452}
447453
448454if (inptr -> lexeme )
449455free (inptr -> lexeme );
450456inptr ++ ;
451457}
452458
459+ if (outptr == d -> subst [i ].res )
460+ elog (ERROR ,"Thesaurus: all words in subsitution aren't recognized by subdictionary" );
461+
453462d -> subst [i ].reslen = outptr - d -> subst [i ].res ;
454463
455464free (rem );