-/* $Id: zebraapi.c,v 1.260 2007-10-29 09:25:41 adam Exp $
+/* $Id: zebraapi.c,v 1.265 2007-11-30 12:19:08 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
data1_set_tabroot (reg->dh, reg_path);
reg->recTypes = recTypes_init (zs->record_classes, reg->dh);
- reg->index_types = 0;
reg->zebra_maps =
zebra_maps_open(res, reg_path, profilePath);
if (!reg->zebra_maps)
record_compression = REC_COMPRESS_BZIP2;
{
- const char *index_types_fname = res_get(res, "indextypes");
- if (index_types_fname)
- {
- char tmp_full_name[1024];
-
- if (!yaz_filepath_resolve(index_types_fname,
- profilePath,
- reg_path,
- tmp_full_name))
- {
- yaz_log(YLOG_WARN, "Could not find %s", index_types_fname);
- ret = ZEBRA_FAIL;
- }
- else
- {
- reg->index_types = zebra_index_types_create(
- tmp_full_name);
- yaz_log(YLOG_LOG, "zebra_index_types_create returned %p",
- reg->index_types);
- }
- }
-
- }
- {
const char *index_fname = res_get_def(res, "index", "default.idx");
if (index_fname && *index_fname)
{
recTypes_destroy (reg->recTypes);
zebra_maps_close (reg->zebra_maps);
- zebra_index_types_destroy(reg->index_types);
zebraRankDestroy (reg);
bfs_destroy (reg->bfs);
data1_destroy (reg->dh);
recs[i].errCode =
zebra_record_fetch(zh, setname,
poset[i].sysno, poset[i].score,
- hit_snippet,
stream, input_format, comp,
&recs[i].format, &buf, &len,
&recs[i].base, &recs[i].errString);
const char *setname)
{
ZEBRA_RES res;
- RSET limit_rset = 0;
ZEBRA_CHECK_HANDLE(zh);
*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, limit_rset);
+ num_entries, entries, is_partial, setname);
zebra_end_read(zh);
return res;
}
return zebra_end_trans (zh);
}
-int zebra_string_norm(ZebraHandle zh, unsigned reg_id,
+int zebra_string_norm(ZebraHandle zh, const char *index_type,
const char *input_str, int input_len,
char *output_str, int output_len)
{
WRBUF wrbuf;
+ zebra_map_t zm = zebra_map_get(zh->reg->zebra_maps, index_type);
ASSERTZH;
assert(input_str);
assert(output_str);
if (!zh->reg->zebra_maps)
return -1;
- wrbuf = zebra_replace(zh->reg->zebra_maps, reg_id, "",
- input_str, input_len);
+ wrbuf = zebra_replace(zm, "", input_str, input_len);
if (!wrbuf)
return -2;
if (wrbuf_len(wrbuf) >= output_len)