X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzebraapi.c;h=5352457ae28fb7d59d5d5f01ba5b1916d1d3f27b;hb=d8e960f5f1060148a5fffa7a767c72391662fbdc;hp=0be396f7fd9001af3b856e20ef01b2e610216e00;hpb=0f3b8bcc6fe2e3beeec7c834d9a64dca48a4f1b7;p=idzebra-moved-to-github.git diff --git a/index/zebraapi.c b/index/zebraapi.c index 0be396f..5352457 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.163 2005-04-28 08:20:40 adam Exp $ +/* $Id: zebraapi.c,v 1.167 2005-05-09 10:16:13 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -147,6 +147,8 @@ ZebraHandle zebra_open (ZebraService zs) zh->store_data_buf = 0; + zh->m_limit = zebra_limit_create(1, 0); + return zh; } @@ -535,6 +537,9 @@ ZEBRA_RES zebra_close (ZebraHandle zh) xfree(zh->reg_name); xfree(zh->user_perm); zh->service = 0; /* more likely to trigger an assert */ + + zebra_limit_destroy(zh->m_limit); + xfree(zh->path_reg); xfree(zh); return ZEBRA_OK; @@ -647,6 +652,20 @@ static void zebra_select_register (ZebraHandle zh, const char *new_reg) zh->lock_shadow = zebra_lock_create (res_get(zh->res, "lockDir"), fname, 0); + if (!zh->lock_normal || !zh->lock_shadow) + { + if (zh->lock_normal) + { + zebra_lock_destroy(zh->lock_normal); + zh->lock_normal = 0; + } + if (zh->lock_shadow) + { + zebra_lock_destroy(zh->lock_shadow); + zh->lock_shadow = 0; + } + zebra_close_res(zh); + } } } @@ -692,7 +711,7 @@ int zebra_select_default_database(ZebraHandle zh) const char *group = res_get(zh->service->global_res, "group"); const char *v = res_get_prefix(zh->service->global_res, "database", group, "Default"); - zebra_select_database(zh, v); + return zebra_select_database(zh, v); } return 0; } @@ -2165,9 +2184,24 @@ int zebra_sort_by_specstr (ZebraHandle zh, ODR stream, return sort_status; } +/* --------------------------------------------------------------------------- + Get BFS for Zebra system (to make alternative storage methods) +*/ struct BFiles_struct *zebra_get_bfs(ZebraHandle zh) { if (zh && zh->reg) return zh->reg->bfs; return 0; } + + +/* --------------------------------------------------------------------------- + Set limit for search/scan +*/ +ZEBRA_RES zebra_set_limit(ZebraHandle zh, int complement_flag, zint *ids) +{ + ASSERTZH; + zebra_limit_destroy(zh->m_limit); + zh->m_limit = zebra_limit_create(complement_flag, ids); + return ZEBRA_OK; +}