X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzsets.c;h=75d5c6c62ff811337954898a54fe07b79ff8dea9;hb=3dfdd7ea2aa006fd41a62ac45c58035633248807;hp=cc1c544d76962a9ba283eae2b651c9122d8b227f;hpb=caa7fe057dd8617129577a6725d2c4e3da066857;p=idzebra-moved-to-github.git diff --git a/index/zsets.c b/index/zsets.c index cc1c544..75d5c6c 100644 --- a/index/zsets.c +++ b/index/zsets.c @@ -4,7 +4,20 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zsets.c,v $ - * Revision 1.3 1995-09-06 16:11:19 adam + * Revision 1.6 1995-09-28 09:19:49 adam + * xfree/xmalloc used everywhere. + * Extract/retrieve method seems to work for text records. + * + * Revision 1.5 1995/09/27 16:17:32 adam + * More work on retrieve. + * + * Revision 1.4 1995/09/07 13:58:36 adam + * New parameter: result-set file descriptor (RSFD) to support multiple + * positions within the same result-set. + * Boolean operators: and, or, not implemented. + * Result-set references. + * + * Revision 1.3 1995/09/06 16:11:19 adam * Option: only one word key per file. * * Revision 1.2 1995/09/06 10:33:04 adam @@ -53,8 +66,62 @@ ZServerSet *resultSetGet (ZServerInfo *zi, const char *name) return NULL; } -ZServerRecord *resultSetRecordGet (ZServerInfo *zi, const char *name, - int num, int *positions) +ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name, + int num, int *positions) +{ + ZServerSet *sset; + ZServerSetSysno *sr; + RSET rset; + int num_i = 0; + int position = 0; + int psysno = 0; + struct it_key key; + RSFD rfd; + + if (!(sset = resultSetGet (zi, name))) + return NULL; + if (!(rset = sset->rset)) + return NULL; + logf (LOG_DEBUG, "resultSetRecordGet"); + sr = xmalloc (sizeof(*sr) * num); + rfd = rset_open (rset, 0); + while (rset_read (rset, rfd, &key)) + { + if (key.sysno != psysno) + { + psysno = key.sysno; + position++; + if (position == positions[num_i]) + { + sr[num_i].sysno = psysno; + num_i++; + if (++num_i == num) + break; + } + } + } + rset_close (rset, rfd); + while (num_i < num) + { + sr[num_i].sysno = 0; + num_i++; + } + return sr; +} + +void resultSetRecordDel (ZServerInfo *zi, ZServerRecord *records, int num) +{ + int i; + + for (i = 0; i