-/* $Id: zebraapi.c,v 1.143 2004-12-02 17:27:03 adam Exp $
+/* $Id: zebraapi.c,v 1.144 2004-12-10 12:37:07 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
if (!(reg->records = rec_open (reg->bfs, rw, record_compression)))
{
- yaz_log (YLOG_WARN, "rec_open");
+ yaz_log (YLOG_WARN, "rec_open failed");
return 0;
}
if (rw)
}
if (!(reg->dict = dict_open_res (reg->bfs, FNAME_DICT, 40, rw, 0, res)))
{
- yaz_log (YLOG_WARN, "dict_open");
+ yaz_log (YLOG_WARN, "dict_open failed");
return 0;
}
if (!(reg->sortIdx = sortIdx_open (reg->bfs, rw)))
{
- yaz_log (YLOG_WARN, "sortIdx_open");
+ yaz_log (YLOG_WARN, "sortIdx_open failed");
return 0;
}
if (res_get_match (res, "isam", "s", ISAM_DEFAULT))
if (!(reg->isams = isams_open (reg->bfs, FNAME_ISAMS, rw,
key_isams_m(res, &isams_m))))
{
- yaz_log (YLOG_WARN, "isams_open");
+ yaz_log (YLOG_WARN, "isams_open failed");
return 0;
}
}
if (!(reg->isamc = isc_open (reg->bfs, FNAME_ISAMC,
rw, key_isamc_m(res, &isamc_m))))
{
- yaz_log (YLOG_WARN, "isc_open");
+ yaz_log (YLOG_WARN, "isc_open failed");
return 0;
}
}
if (!(reg->isamb = isamb_open (reg->bfs, "isamb",
rw, key_isamc_m(res, &isamc_m), 0)))
{
- yaz_log (YLOG_WARN, "isamb_open");
+ yaz_log (YLOG_WARN, "isamb_open failed");
return 0;
}
}
if (!(reg->isamb = isamb_open (reg->bfs, "isamb",
rw, key_isamc_m(res, &isamc_m), 1)))
{
- yaz_log (YLOG_WARN, "isamb_open");
+ yaz_log (YLOG_WARN, "isamb_open failed");
return 0;
}
}
if (!(reg->isamb = isamb_open (reg->bfs, "isamb",
rw, key_isamc_m(res, &isamc_m), -1)))
{
- yaz_log (YLOG_WARN, "isamb_open");
+ yaz_log (YLOG_WARN, "isamb_open failed");
return 0;
}
}
}
#if HAVE_SYS_TIMES_H
times (&zh->tms2);
- yaz_log (YLOG_LOG, "user/system: %ld/%ld",
+ yaz_log (log_level, "user/system: %ld/%ld",
(long) (zh->tms2.tms_utime - zh->tms1.tms_utime),
(long) (zh->tms2.tms_stime - zh->tms1.tms_stime));
rval = res_get (zh->res, "shadow");
if (!rval)
{
- yaz_log (YLOG_WARN, "Cannot perform commit");
- yaz_log (YLOG_WARN, "No shadow area defined");
+ yaz_log (YLOG_WARN, "Cannot perform commit - No shadow area defined");
return 0;
}
}
else
{
- yaz_log (YLOG_LOG, "nothing to commit");
+ yaz_log (log_level, "nothing to commit");
}
bfs_destroy (bfs);
-/* $Id: zrpn.c,v 1.163 2004-11-29 21:55:27 adam Exp $
+/* $Id: zrpn.c,v 1.164 2004-12-10 12:37:07 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
} AttrType;
+static int log_level_set=0;
+static int log_level_rpn=0;
+
static const char **rpn_char_map_handler(void *vp, const char **from, int len)
{
struct rpn_char_map_info *p = (struct rpn_char_map_info *) vp;
static void add_isam_p(const char *name, const char *info,
struct grep_info *p)
{
+ if (!log_level_set)
+ {
+ log_level_rpn = yaz_log_module_level("rpn");
+ log_level_set=1;
+ }
if (p->isam_p_indx == p->isam_p_size)
{
ISAMC_P *new_isam_p_buf;
int len = key_SU_decode (&su_code, name);
term_untrans (p->zh, p->reg_type, term_tmp, name+len+1);
- yaz_log(YLOG_LOG, "grep: %d %c %s", su_code, name[len], term_tmp);
+ yaz_log(log_level_rpn, "grep: %d %c %s", su_code, name[len], term_tmp);
zebraExplain_lookup_ord (p->zh->reg->zei,
su_code, &db, &set, &use);
- yaz_log(YLOG_LOG, "grep: set=%d use=%d db=%s", set, use, db);
+ yaz_log(log_level_rpn, "grep: set=%d use=%d db=%s", set, use, db);
resultSetAddTerm(p->zh, p->termset, name[len], db,
set, use, term_tmp);
term_sub, term_component,
space_split, term_dst))
return 0;
- yaz_log(YLOG_DEBUG, "Relation <");
+ yaz_log(log_level_rpn, "Relation <");
*term_tmp++ = '(';
for (i = 0; term_component[i]; )
term_sub, term_component,
space_split, term_dst))
return 0;
- yaz_log(YLOG_DEBUG, "Relation <=");
+ yaz_log(log_level_rpn, "Relation <=");
*term_tmp++ = '(';
for (i = 0; term_component[i]; )
if (!term_100 (zh->reg->zebra_maps, reg_type,
term_sub, term_component, space_split, term_dst))
return 0;
- yaz_log(YLOG_DEBUG, "Relation >");
+ yaz_log(log_level_rpn, "Relation >");
*term_tmp++ = '(';
for (i = 0; term_component[i];)
if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub,
term_component, space_split, term_dst))
return 0;
- yaz_log(YLOG_DEBUG, "Relation >=");
+ yaz_log(log_level_rpn, "Relation >=");
*term_tmp++ = '(';
for (i = 0; term_component[i];)
break;
case 3:
default:
- yaz_log(YLOG_DEBUG, "Relation =");
+ yaz_log(log_level_rpn, "Relation =");
if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub,
term_component, space_split, term_dst))
return 0;
term_dst, xpath_use);
if (r < 1)
return 0;
- yaz_log(YLOG_DEBUG, "term: %s", term_dst);
+ yaz_log(log_level_rpn, "term: %s", term_dst);
return rset_trunc(zh, grep_info->isam_p_buf,
grep_info->isam_p_indx, term_dst,
strlen(term_dst), rank_type, 1 /* preserve pos */,
rpn_char_map_prepare (zh->reg, reg_type, &rcmi);
attr_init (&use, zapt, 1);
use_value = attr_find_ex (&use, &curAttributeSet, &use_string);
- yaz_log(YLOG_DEBUG, "string_term, use value %d", use_value);
+ yaz_log(log_level_rpn, "string_term, use value %d", use_value);
attr_init (&truncation, zapt, 5);
truncation_value = attr_find (&truncation, NULL);
- yaz_log(YLOG_DEBUG, "truncation value %d", truncation_value);
+ yaz_log(log_level_rpn, "truncation value %d", truncation_value);
if (use_value == -1) /* no attribute - assumy "any" */
use_value = 1016;
term_dict[prefix_len++] = ')';
term_dict[prefix_len++] = 1;
term_dict[prefix_len++] = reg_type;
- yaz_log(YLOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]);
+ yaz_log(log_level_rpn, "reg_type = %d", term_dict[prefix_len-1]);
term_dict[prefix_len] = '\0';
j = prefix_len;
switch (truncation_value)
}
if (attr_ok)
{
- yaz_log(YLOG_DEBUG, "dict_lookup_grep: %s", term_dict+prefix_len);
+ yaz_log(log_level_rpn, "dict_lookup_grep: %s", term_dict+prefix_len);
r = dict_lookup_grep(zh->reg->dict, term_dict, regex_range,
grep_info, &max_pos, init_pos,
grep_handle);
}
else
termset_name = termset_value_string;
- yaz_log(YLOG_LOG, "creating termset set %s", termset_name);
+ yaz_log(log_level_rpn, "creating termset set %s", termset_name);
grep_info->termset = resultSetAdd (zh, termset_name, 1);
if (!grep_info->termset)
{
return 0;
while (1)
{
- yaz_log(YLOG_DEBUG, "APT_phrase termp=%s", termp);
+ yaz_log(log_level_rpn, "APT_phrase termp=%s", termp);
rset[rset_no] = term_trunc(zh, zapt, &termp, attributeSet,
stream, &grep_info,
reg_type, complete_flag,
return 0;
while (1)
{
- yaz_log(YLOG_DEBUG, "APT_or_list termp=%s", termp);
+ yaz_log(log_level_rpn, "APT_or_list termp=%s", termp);
rset[rset_no] = term_trunc(zh, zapt, &termp, attributeSet,
stream, &grep_info,
reg_type, complete_flag,
return 0;
while (1)
{
- yaz_log(YLOG_DEBUG, "APT_and_list termp=%s", termp);
+ yaz_log(log_level_rpn, "APT_and_list termp=%s", termp);
rset[rset_no] = term_trunc(zh, zapt, &termp, attributeSet,
stream, &grep_info,
reg_type, complete_flag,
attr_init (&relation, zapt, 2);
relation_value = attr_find (&relation, NULL);
- yaz_log(YLOG_DEBUG, "numeric relation value=%d", relation_value);
+ yaz_log(log_level_rpn, "numeric relation value=%d", relation_value);
if (!term_100 (zh->reg->zebra_maps, reg_type, term_sub, term_tmp, 1,
term_dst))
switch (relation_value)
{
case 1:
- yaz_log(YLOG_DEBUG, "Relation <");
+ yaz_log(log_level_rpn, "Relation <");
gen_regular_rel (term_tmp, term_value-1, 1);
break;
case 2:
- yaz_log(YLOG_DEBUG, "Relation <=");
+ yaz_log(log_level_rpn, "Relation <=");
gen_regular_rel (term_tmp, term_value, 1);
break;
case 4:
- yaz_log(YLOG_DEBUG, "Relation >=");
+ yaz_log(log_level_rpn, "Relation >=");
gen_regular_rel (term_tmp, term_value, 0);
break;
case 5:
- yaz_log(YLOG_DEBUG, "Relation >");
+ yaz_log(log_level_rpn, "Relation >");
gen_regular_rel (term_tmp, term_value+1, 0);
break;
case 3:
default:
- yaz_log(YLOG_DEBUG, "Relation =");
+ yaz_log(log_level_rpn, "Relation =");
sprintf (term_tmp, "(0*%d)", term_value);
}
- yaz_log(YLOG_DEBUG, "dict_lookup_grep: %s", term_tmp);
+ yaz_log(log_level_rpn, "dict_lookup_grep: %s", term_tmp);
r = dict_lookup_grep(zh->reg->dict, term_dict, 0, grep_info, max_pos,
0, grep_handle);
if (r)
yaz_log(YLOG_WARN, "dict_lookup_grep fail, rel=gt: %d", r);
- yaz_log(YLOG_DEBUG, "%d positions", grep_info->isam_p_indx);
+ yaz_log(log_level_rpn, "%d positions", grep_info->isam_p_indx);
return 1;
}
int r, rset_no = 0;
struct grep_info grep_info;
- yaz_log(YLOG_DEBUG, "APT_numeric t='%s'",termz);
+ yaz_log(log_level_rpn, "APT_numeric t='%s'",termz);
if (grep_info_prepare (zh, zapt, &grep_info, reg_type, stream))
return 0;
while (1)
if (xpath_len < 0)
return rset;
- yaz_log (YLOG_LOG, "len=%d", xpath_len);
+ yaz_log (YLOG_DEBUG, "xpath len=%d", xpath_len);
for (i = 0; i<xpath_len; i++)
{
- yaz_log (YLOG_LOG, "XPATH %d %s", i, xpath[i].part);
+ yaz_log (log_level_rpn, "XPATH %d %s", i, xpath[i].part);
}
if (!first_path)
continue;
}
- yaz_log (YLOG_LOG, "xpath_rev (%d) = %s", level, xpath_rev);
+ yaz_log (log_level_rpn, "xpath_rev (%d) = %s", level, xpath_rev);
if (strlen(xpath_rev))
{
rset_start_tag = xpath_trunc(zh, stream, '0',
int xpath_use = 0;
struct xpath_location_step xpath[10];
+ if (!log_level_set)
+ {
+ log_level_rpn = yaz_log_module_level("rpn");
+ log_level_set=1;
+ }
zebra_maps_attr (zh->reg->zebra_maps, zapt, ®_id, &search_type,
rank_type, &complete_flag, &sort_flag);