X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzlogs.c;h=7c820ba37e68c80ab47d46161a2f8d3d599a8f07;hb=801ef4b322574c793abdc1ba81dea2da62ca60bc;hp=30920cc259d5c250fbd6c92eb845b1bbbe1684c1;hpb=44cec91a73f331f5825fea0f2ef640cc28fdda11;p=idzebra-moved-to-github.git diff --git a/index/zlogs.c b/index/zlogs.c index 30920cc..7c820ba 100644 --- a/index/zlogs.c +++ b/index/zlogs.c @@ -1,10 +1,22 @@ /* - * Copyright (C) 1994-1995, Index Data I/S + * Copyright (C) 1995-1998, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: zlogs.c,v $ - * Revision 1.3 1996-03-20 09:36:40 adam + * Revision 1.7 1998-01-29 13:40:11 adam + * Better logging for scan service. + * + * Revision 1.6 1997/09/29 09:06:41 adam + * Removed static var to make this module thread safe. + * + * Revision 1.5 1997/04/30 08:56:07 quinn + * null + * + * Revision 1.4 1996/10/08 09:41:25 quinn + * Fixed diagnostic. + * + * Revision 1.3 1996/03/20 09:36:40 adam * Function dict_lookup_grep got extra parameter, init_pos, which marks * from which position in pattern approximate pattern matching should occur. * Approximate pattern matching is used in relevance=re-2. @@ -21,10 +33,8 @@ #include "zserver.h" -static char *attrStr (int type, int value, enum oid_value ast) +static void attrStr (int type, int value, enum oid_value ast, char *str) { - static char str[80]; - *str = '\0'; switch (ast) { @@ -197,7 +207,6 @@ static char *attrStr (int type, int value, enum oid_value ast) sprintf (str + strlen(str), " (%d=%d)", type, value); else sprintf (str, "%d=%d", type, value); - return str; } /* @@ -207,6 +216,7 @@ static void zlog_attributes (Z_AttributesPlusTerm *t, int level, enum oid_value ast) { int of, i; + char str[80]; for (of = 0; of < t->num_attributes; of++) { Z_AttributeElement *element; @@ -215,8 +225,9 @@ static void zlog_attributes (Z_AttributesPlusTerm *t, int level, switch (element->which) { case Z_AttributeValue_numeric: - logf (LOG_LOG, "%*.s %s", level, "", - attrStr (*element->attributeType, *element->value.numeric, ast)); + attrStr (*element->attributeType, + *element->value.numeric, ast, str); + logf (LOG_LOG, "%*.s %s", level, "", str); break; case Z_AttributeValue_complex: logf (LOG_LOG, "%*.s attributeType=%d complex", level, "", @@ -252,7 +263,7 @@ static void zlog_structure (Z_RPNStructure *zs, int level, enum oid_value ast) logf (LOG_LOG, "%*.s or", level, ""); break; case Z_Operator_and_not: - logf (LOG_LOG, "%*.s and", level, ""); + logf (LOG_LOG, "%*.s and-not", level, ""); break; default: logf (LOG_LOG, "%*.s unknown complex", level, ""); @@ -299,3 +310,16 @@ void zlog_rpn (Z_RPNQuery *rpn) logf (LOG_LOG, "RPN query. Type: %s", attrset->desc); zlog_structure (rpn->RPNStructure, 0, ast); } + +void zlog_scan (Z_AttributesPlusTerm *zapt, oid_value ast) +{ + int level = 0; + if (zapt->term->which == Z_Term_general) + { + logf (LOG_LOG, "%*.s term '%.*s' (general)", level, "", + zapt->term->u.general->len, zapt->term->u.general->buf); + } + else + logf (LOG_LOG, "%*.s term (not general)", level, ""); + zlog_attributes (zapt, level+2, ast); +}