--- trunk/pgswish.c 2005/05/29 22:41:20 22 +++ trunk/pgswish.c 2005/05/29 23:00:19 23 @@ -77,7 +77,7 @@ * STDOUT and STDERR (just to be sure) */ if ( logfh = fopen("/tmp/pgswish.log", "a") ) { set_error_handle( logfh ); - elog(INFO, "loggin swish-e errors to /tmp/pgswish.log"); + elog(DEBUG1, "loggin swish-e errors to /tmp/pgswish.log"); /* redirect STDOUT and STDERR to log */ dup2(1, logfh); dup2(2, logfh); @@ -85,17 +85,13 @@ elog(INFO, "can't open /tmp/pgswish.log -- errors from swish-e won't be cought and may result in back-end crashes!"); } - elog(INFO, "pgswish: SwishInit(%s)", index_path); + elog(DEBUG1, "pgswish: SwishInit(%s)", index_path); swish_handle = SwishInit( index_path ); - if ( SwishError( swish_handle ) ) - elog(INFO, "pgswish: SwishInit(%s) failed: %s", index_path, SwishErrorString( swish_handle )); + if ( SwishError( swish_handle ) || ! swish_handle) { + elog(ERROR, "pgswish: SwishInit(%s) failed: %s", index_path, SwishErrorString( swish_handle )); - elog(INFO, "handle: %08x", swish_handle); - - if (! swish_handle) { - elog(ERROR, "pgswish: can't open %s", index_path); SRF_RETURN_DONE(funcctx); } @@ -104,7 +100,7 @@ SwishRankScheme( swish_handle, 0 ); if (error_or_abort( swish_handle )) SRF_RETURN_DONE(funcctx); - elog(INFO, "pgswish: SwishQuery(%s)", query); + elog(DEBUG1, "pgswish: SwishQuery(%s)", query); /* Here's a short-cut to searching that creates a search object and searches at the same time */ swish_results = SwishQuery( swish_handle, query); if (error_or_abort( swish_handle )) SRF_RETURN_DONE(funcctx); @@ -116,7 +112,7 @@ if ( 0 == funcctx->max_calls ) elog(INFO, "no results for: %s", query ); - elog(INFO, "pgswish: SwishHits = %d", funcctx->max_calls); + elog(DEBUG1, "pgswish: SwishHits = %d", funcctx->max_calls); /* Build a tuple description for a __pgswish tuple */ tupdesc = RelationNameGetTupleDesc("__pgswish"); @@ -136,7 +132,7 @@ MemoryContextSwitchTo(oldcontext); - elog(INFO, "SRF_IS_FIRSTCALL done"); + elog(DEBUG1, "SRF_IS_FIRSTCALL done"); } /* stuff done on every call of the function */ @@ -152,7 +148,7 @@ HeapTuple tuple; Datum result; - elog(INFO, "pgswish: loop count %d", call_cntr); + elog(DEBUG1, "pgswish: loop count %d", call_cntr); if (! swish_results) { elog(ERROR, "pgswish: no swish-e results"); @@ -176,7 +172,7 @@ SRF_RETURN_DONE(funcctx); } - elog(INFO, "Path: %s\n Rank: %lu\n Size: %lu\n Title: %s\n Index: %s\n Modified: %s\n Record #: %lu\n File #: %lu\n\n", + elog(DEBUG1, "Path: %s\n Rank: %lu\n Size: %lu\n Title: %s\n Index: %s\n Modified: %s\n Record #: %lu\n File #: %lu\n\n", SwishResultPropertyStr ( sw_res, "swishdocpath" ), SwishResultPropertyULong ( sw_res, "swishrank" ), SwishResultPropertyULong ( sw_res, "swishdocsize" ), @@ -222,7 +218,7 @@ SRF_RETURN_NEXT(funcctx, result); } else { - elog(INFO, "loop over"); + elog(DEBUG1, "loop over"); /* free swish object and close */ Free_Search_Object( search ); @@ -366,7 +362,7 @@ * STDOUT and STDERR (just to be sure) */ if ( logfh = fopen("/tmp/pgswish.log", "a") ) { set_error_handle( logfh ); - elog(INFO, "loggin swish-e errors to /tmp/pgswish.log"); + elog(DEBUG1, "loggin swish-e errors to /tmp/pgswish.log"); /* redirect STDOUT and STDERR to log */ dup2(1, logfh); dup2(2, logfh); @@ -374,7 +370,7 @@ elog(INFO, "can't open /tmp/pgswish.log -- errors from swish-e won't be cought and may result in back-end crashes!"); } - elog(INFO, "pgswish: SwishInit(%s)", index_path); + elog(DEBUG1, "pgswish: SwishInit(%s)", index_path); swish_handle = SwishInit( index_path ); @@ -391,7 +387,7 @@ SwishRankScheme( swish_handle, 0 ); error_or_abort( swish_handle ); - elog(INFO, "pgswish: SwishQuery(%s)", query); + elog(DEBUG1, "pgswish: SwishQuery(%s)", query); /* Here's a short-cut to searching that creates a search object * and searches at the same time */ @@ -435,7 +431,7 @@ if (! ( SwishErrorString( swish_handle ) ) ) { elog(INFO, "can't find result %d", i + offset); } else { - elog(INFO, "Path: %s\n Rank: %lu\n Size: %lu\n Title: %s\n Index: %s\n Modified: %s\n Record #: %lu\n File #: %lu\n\n", + elog(DEBUG1, "Path: %s\n Rank: %lu\n Size: %lu\n Title: %s\n Index: %s\n Modified: %s\n Record #: %lu\n File #: %lu\n\n", SwishResultPropertyStr ( sw_res, "swishdocpath" ), SwishResultPropertyULong ( sw_res, "swishrank" ), SwishResultPropertyULong ( sw_res, "swishdocsize" ),