From 9d961069395f4ff45425de0fa847312dcb88a189 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 2 Dec 2004 17:27:03 +0000 Subject: [PATCH] Added zebra_meta_records_create_range --- include/idzebra/api.h | 31 +++++++++++++++++++------------ index/zebraapi.c | 8 ++++---- index/zsets.c | 27 ++++++++++++++++++++++++++- 3 files changed, 49 insertions(+), 17 deletions(-) diff --git a/include/idzebra/api.h b/include/idzebra/api.h index 6b53295..53ae58d 100644 --- a/include/idzebra/api.h +++ b/include/idzebra/api.h @@ -1,4 +1,4 @@ -/* $Id: api.h,v 1.3 2004-11-29 21:55:25 adam Exp $ +/* $Id: api.h,v 1.4 2004-12-02 17:27:03 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -149,11 +149,11 @@ YAZ_EXPORT int zebra_deleleResultSet(ZebraHandle zh, int function, /* Browse */ YAZ_EXPORT int zebra_scan (ZebraHandle zh, ODR stream, - Z_AttributesPlusTerm *zapt, - oid_value attributeset, - int *position, int *num_entries, - ZebraScanEntry **list, - int *is_partial); + Z_AttributesPlusTerm *zapt, + oid_value attributeset, + int *position, int *num_entries, + ZebraScanEntry **list, + int *is_partial); @@ -272,12 +272,19 @@ typedef struct { int score; } ZebraMetaRecord; -YAZ_EXPORT ZebraMetaRecord *zebra_meta_records_create (ZebraHandle zh, - const char *name, - int num, - zint *positions); +YAZ_EXPORT +ZebraMetaRecord *zebra_meta_records_create (ZebraHandle zh, + const char *name, + int num, zint *positions); + -YAZ_EXPORT void zebra_meta_records_destroy (ZebraHandle zh, - ZebraMetaRecord *records, int num); +YAZ_EXPORT +ZebraMetaRecord *zebra_meta_records_create_range (ZebraHandle zh, + const char *name, + zint start, int num); + +YAZ_EXPORT +void zebra_meta_records_destroy (ZebraHandle zh, ZebraMetaRecord *records, + int num); YAZ_END_CDECL #endif diff --git a/index/zebraapi.c b/index/zebraapi.c index 377ab7b..5861a23 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.142 2004-11-29 21:55:27 adam Exp $ +/* $Id: zebraapi.c,v 1.143 2004-12-02 17:27:03 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -847,9 +847,9 @@ int zebra_search_RPN (ZebraHandle zh, ODR o, } int zebra_records_retrieve (ZebraHandle zh, ODR stream, - const char *setname, Z_RecordComposition *comp, - oid_value input_format, int num_recs, - ZebraRetrievalRecord *recs) + const char *setname, Z_RecordComposition *comp, + oid_value input_format, int num_recs, + ZebraRetrievalRecord *recs) { ZebraMetaRecord *poset; int i, ret = 0; diff --git a/index/zsets.c b/index/zsets.c index 6fe00c4..52cb82b 100644 --- a/index/zsets.c +++ b/index/zsets.c @@ -1,4 +1,4 @@ -/* $Id: zsets.c,v 1.72 2004-11-29 21:55:28 adam Exp $ +/* $Id: zsets.c,v 1.73 2004-12-02 17:27:04 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -278,6 +278,31 @@ void resultSetDestroy (ZebraHandle zh, int num, char **names,int *statuses) } } +ZebraMetaRecord *zebra_meta_records_create_range (ZebraHandle zh, + const char *name, + zint start, int num) +{ + zint pos_small[10]; + zint *pos = pos_small; + ZebraMetaRecord *mr; + int i; + + if (num > 10000 || num <= 0) + return 0; + + if (num > 10) + pos = xmalloc(sizeof(*pos) * num); + + for (i = 0; i 10) + xfree(pos); + return mr; +} + ZebraMetaRecord *zebra_meta_records_create (ZebraHandle zh, const char *name, int num, zint *positions) { -- 1.7.10.4