-/* $Id: zebraapi.c,v 1.179 2005-06-23 06:45:46 adam Exp $
+/* $Id: zebraapi.c,v 1.184 2005-08-22 09:04:18 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
zh->lock_shadow = 0;
zh->shadow_enable = 1;
+ zh->m_staticrank = 0;
default_encoding = res_get_def(zs->global_res, "encoding", "ISO-8859-1");
log_level = yaz_log_module_level("zebraapi");
log_level_initialized = 1;
}
-
- yaz_log(YLOG_LOG, "zebra_start %s %s",configName, ZEBRAVER);
- assert(configName);
+
+ yaz_log(YLOG_LOG, "zebra_start %s %s", ZEBRAVER,
+ configName ? configName : "");
if ((res = res_open (configName, def_res, over_res)))
{
const char *passwd_encrypt = 0;
ZebraService zh = xmalloc(sizeof(*zh));
- yaz_log (YLOG_DEBUG, "Read resources `%s'", configName);
-
zh->global_res = res;
- zh->configName = xstrdup(configName);
zh->sessions = 0;
zebra_chdir (zh);
reg->key_file_no = 0;
reg->ptr_i = 0;
- zebraRankInstall (reg, rank1_class);
- zebraRankInstall (reg, rankzv_class);
+ zebraRankInstall (reg, rank_1_class);
+ zebraRankInstall (reg, rank_zv_class);
+ zebraRankInstall (reg, rank_static_class);
recordCompression = res_get_def (res, "recordCompression", "none");
if (!strcmp (recordCompression, "none"))
recTypeClass_destroy(zs->record_classes);
nmem_destroy(zs->nmem);
res_close (zs->global_res);
- xfree(zs->configName);
xfree(zs);
return ZEBRA_OK;
}
if (res_get_int(zh->res, "estimatehits", &approx) == ZEBRA_OK)
zebra_set_approx_limit(zh, approx);
}
+ if (zh->res)
+ {
+ if (res_get_int(zh->res, "staticrank", &zh->m_staticrank) == ZEBRA_OK)
+ yaz_log(YLOG_LOG, "static rank set and is %d", zh->m_staticrank);
+ else
+ yaz_log(YLOG_LOG, "static rank unset");
+ }
}
void map_basenames_func (void *vp, const char *name, const char *value)
ZEBRA_RES zebra_scan_PQF(ZebraHandle zh, ODR stream, const char *query,
int *position,
int *num_entries, ZebraScanEntry **entries,
- int *is_partial)
+ int *is_partial,
+ const char *setname)
{
YAZ_PQF_Parser pqf_parser = yaz_pqf_create ();
Z_AttributesPlusTerm *zapt;
}
else
res = zebra_scan(zh, stream, zapt, VAL_BIB1,
- position, num_entries, entries, is_partial);
+ position, num_entries, entries, is_partial,
+ setname);
yaz_pqf_destroy (pqf_parser);
return res;
}
oid_value attributeset,
int *position,
int *num_entries, ZebraScanEntry **entries,
- int *is_partial)
+ int *is_partial,
+ const char *setname)
{
ZEBRA_RES res;
+ RSET limit_rset = 0;
ASSERTZH;
assert(stream);
assert(zapt);
*num_entries = 0;
return ZEBRA_FAIL;
}
+ if (setname)
+ {
+ limit_rset = resultSetRef(zh, setname);
+ if (!limit_rset)
+ {
+ zebra_setError(zh,
+ YAZ_BIB1_SPECIFIED_RESULT_SET_DOES_NOT_EXIST,
+ setname);
+ zebra_end_read (zh);
+ return ZEBRA_FAIL;
+ }
+ }
res = rpn_scan (zh, stream, zapt, attributeset,
zh->num_basenames, zh->basenames, position,
- num_entries, entries, is_partial, 0, 0);
+ num_entries, entries, is_partial, limit_rset, 0);
zebra_end_read (zh);
return res;
}
Odr_oct *oct = fragment->u.notExternallyTagged;
sysno = 0;
- if ( zebra_update_record(zh,
- 0, /* record Type */
- &sysno,
- 0, /* match */
- 0, /* fname */
- oct->buf, oct->len,
- 0) == ZEBRA_FAIL)
+ if (zebra_update_record(zh,
+ 0, /* record Type */
+ &sysno,
+ 0, /* match */
+ 0, /* fname */
+ (const char *) oct->buf, oct->len,
+ 0) == ZEBRA_FAIL)
res = ZEBRA_FAIL;
}
}
const char *v;
ASSERTZH;
assert(name);
- assert(defaultvalue);
v = res_get_def (zh->res, name, (char *)defaultvalue);
zebra_clearError(zh);
yaz_log(log_level, "zebra_get_resource %s:%s", name, v);