X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzebraapi.c;h=202f7bbf56a6b149411559f97e46e96a428fcd34;hb=7598c76f1a4989a91003bd4fbd90f30a7c7255ef;hp=1cb58e657c8b7382f4a0c94411c93203fccda716;hpb=183b746522e090db50f827ed39c57acabfa9e9c5;p=idzebra-moved-to-github.git diff --git a/index/zebraapi.c b/index/zebraapi.c index 1cb58e6..202f7bb 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,8 +1,5 @@ -/* $Id: zebraapi.c,v 1.268 2007-12-18 13:55:28 adam Exp $ - Copyright (C) 1995-2007 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) 1995-2008 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -426,6 +423,10 @@ struct zebra_register *zebra_register_open(ZebraService zs, const char *name, if (zebra_maps_read_file(reg->zebra_maps, index_fname) != ZEBRA_OK) ret = ZEBRA_FAIL; } + else + { + zebra_maps_define_default_sort(reg->zebra_maps); + } } if (!(reg->records = rec_open(reg->bfs, rw, record_compression))) @@ -448,6 +449,8 @@ struct zebra_register *zebra_register_open(ZebraService zs, const char *name, sort_type = ZEBRA_SORT_TYPE_FLAT; else if (res_get_match(res, "sortindex", "i", "f")) sort_type = ZEBRA_SORT_TYPE_ISAMB; + else if (res_get_match(res, "sortindex", "m", "f")) + sort_type = ZEBRA_SORT_TYPE_MULTI; else { yaz_log(YLOG_WARN, "bad_value for 'sortindex'"); @@ -1124,11 +1127,18 @@ ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream, } else { - for (i = 0; i 0) { @@ -1162,7 +1176,6 @@ ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream, else recs[i].buf = buf; recs[i].score = poset[i].score; - recs[i].sysno = poset[i].sysno; zebra_snippets_destroy(hit_snippet); } else @@ -1176,14 +1189,10 @@ ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream, ret = ZEBRA_FAIL; break; } - recs[i].buf = 0; /* no record and no error issued */ - recs[i].len = 0; - recs[i].errCode = 0; - recs[i].format = 0; - recs[i].sysno = 0; } } zebra_meta_records_destroy(zh, poset, num_recs); + wrbuf_destroy(addinfo_w); } zebra_end_read(zh); xfree(pos_array); @@ -1929,22 +1938,33 @@ ZEBRA_RES zebra_end_transaction(ZebraHandle zh, ZebraTransactionStatus *status) ZEBRA_RES zebra_repository_update(ZebraHandle zh, const char *path) { - ASSERTZH; - assert(path); - yaz_log(log_level, "updating %s", path); - - if (zh->m_record_id && !strcmp(zh->m_record_id, "file")) - return zebra_update_file_match(zh, path); - else - return zebra_update_from_path(zh, path); + return zebra_repository_index(zh, path, action_update); } ZEBRA_RES zebra_repository_delete(ZebraHandle zh, const char *path) { + return zebra_repository_index(zh, path, action_delete); +} + +ZEBRA_RES zebra_repository_index(ZebraHandle zh, const char *path, + enum zebra_recctrl_action_t action) +{ ASSERTZH; assert(path); - yaz_log(log_level, "deleting %s", path); - return zebra_delete_from_path(zh, path); + + if (action == action_update) + yaz_log(log_level, "updating %s", path); + else if (action == action_delete) + yaz_log(log_level, "deleting %s", path); + else if (action == action_a_delete) + yaz_log(log_level, "attempt deleting %s", path); + else + yaz_log(log_level, "update action=%d", (int) action); + + if (zh->m_record_id && !strcmp(zh->m_record_id, "file")) + return zebra_update_file_match(zh, path); + else + return zebra_update_from_path(zh, path, action); } ZEBRA_RES zebra_repository_show(ZebraHandle zh, const char *path)