X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=index%2Fzebraapi.c;h=b4026fd35b886153b583ca255c99fee48afc8bad;hp=1cb58e657c8b7382f4a0c94411c93203fccda716;hb=0ef68e6e54cfd7a91a28ee3b1f305924ac34e787;hpb=183b746522e090db50f827ed39c57acabfa9e9c5 diff --git a/index/zebraapi.c b/index/zebraapi.c index 1cb58e6..b4026fd 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 @@ -448,6 +445,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'"); @@ -1929,22 +1928,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)