From: Adam Dickmeiss Date: Fri, 12 Feb 1999 13:29:19 +0000 (+0000) Subject: Implemented position-flag for registers. X-Git-Tag: ZEBRA.1.0~135 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=2730140edaab8fc1df36e4b82fb1a4fcc523de05 Implemented position-flag for registers. --- diff --git a/CHANGELOG b/CHANGELOG index 9f5c3c2..50bae80 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +Implemented "position"-flag for register type (as defined in +default.idx). When set to zero no position (or seqence number) is +saved in register for each word occurrence, thus saving some register +space. + Implemented database mapping. Using mapdb one can specify a database to be mapped to one or more physical databases. Usage: mapdb .. diff --git a/include/zebramap.h b/include/zebramap.h index 96304df..974d80c 100644 --- a/include/zebramap.h +++ b/include/zebramap.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zebramap.h,v $ - * Revision 1.7 1999-02-02 14:50:46 adam + * Revision 1.8 1999-02-12 13:29:21 adam + * Implemented position-flag for registers. + * + * Revision 1.7 1999/02/02 14:50:46 adam * Updated WIN32 code specific sections. Changed header. * * Revision 1.6 1998/06/23 15:33:33 adam @@ -60,6 +63,7 @@ int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes); int zebra_maps_is_complete (ZebraMaps zms, unsigned reg_id); int zebra_maps_is_sort (ZebraMaps zms, unsigned reg_id); +int zebra_maps_is_positioned (ZebraMaps zms, unsigned reg_id); #ifdef __cplusplus } #endif diff --git a/index/extract.c b/index/extract.c index ebd04ac..d9c619b 100644 --- a/index/extract.c +++ b/index/extract.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: extract.c,v $ - * Revision 1.90 1999-02-02 14:50:52 adam + * Revision 1.91 1999-02-12 13:29:22 adam + * Implemented position-flag for registers. + * + * Revision 1.90 1999/02/02 14:50:52 adam * Updated WIN32 code specific sections. Changed header. * * Revision 1.89 1998/10/28 10:54:38 adam @@ -426,6 +429,7 @@ int key_open (struct recordGroup *rGroup, int mem) struct encode_info { int sysno; int seqno; + int cmd; char buf[768]; }; @@ -433,6 +437,7 @@ void encode_key_init (struct encode_info *i) { i->sysno = 0; i->seqno = 0; + i->cmd = -1; } char *encode_key_int (int d, char *bp) @@ -474,8 +479,11 @@ void encode_key_write (char *k, struct encode_info *i, FILE *outf) i->sysno = key.sysno; i->seqno = 0; } + else if (!i->seqno && !key.seqno && i->cmd == *k) + return; bp = encode_key_int (key.seqno - i->seqno, bp); i->seqno = key.seqno; + i->cmd = *k; if (fwrite (i->buf, bp - i->buf, 1, outf) != 1) { logf (LOG_FATAL|LOG_ERRNO, "fwrite"); @@ -696,7 +704,8 @@ static void addIndexString (RecWord *p, const char *string, int length) dst += sizeof(*pseqno); } reckeys.buf_used = dst - reckeys.buf; - (*pseqno)++; + if (*pseqno) + (*pseqno)++; } static void addSortString (RecWord *p, const char *string, int length) @@ -1258,7 +1267,12 @@ static int recordExtract (SYSNO *sysno, const char *fname, extractCtrl.addSchema = addSchema; extractCtrl.dh = rGroup->dh; for (i = 0; i<256; i++) - extractCtrl.seqno[i] = 0; + { + if (zebra_maps_is_positioned(rGroup->zebra_maps, i)) + extractCtrl.seqno[i] = 1; + else + extractCtrl.seqno[i] = 0; + } extractCtrl.zebra_maps = rGroup->zebra_maps; extractCtrl.flagShowRecords = !rGroup->flagRw; diff --git a/index/invstat.c b/index/invstat.c index b368277..3c3c55a 100644 --- a/index/invstat.c +++ b/index/invstat.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: invstat.c,v $ - * Revision 1.8 1999-02-02 14:50:53 adam + * Revision 1.9 1999-02-12 13:29:23 adam + * Implemented position-flag for registers. + * + * Revision 1.8 1999/02/02 14:50:53 adam * Updated WIN32 code specific sections. Changed header. * * Revision 1.7 1998/03/13 15:30:50 adam @@ -67,6 +70,7 @@ static int inv_stat_handle (char *name, const char *info, int pos, assert (*info == sizeof(ISAM_P)); memcpy (&isam_p, info+1, sizeof(ISAM_P)); + printf ("---\n"); if (stat_info->isam) { ISPT ispt; @@ -79,12 +83,15 @@ static int inv_stat_handle (char *name, const char *info, int pos, { ISAMC_PP pp; int occurx = 0; - char buf[128]; + struct it_key key; pp = isc_pp_open (stat_info->isamc, isam_p); occur = isc_pp_num (pp); - while (isc_pp_read(pp, buf)) + while (isc_pp_read(pp, &key)) + { + printf ("sysno=%d seqno=%d\n", key.sysno, key.seqno); occurx++; + } assert (occurx == occur); stat_info->no_isam_entries[isc_type(isam_p)] += occur; isc_pp_close (pp); diff --git a/tab/default.idx b/tab/default.idx index 49bff34..029bb9f 100644 --- a/tab/default.idx +++ b/tab/default.idx @@ -1,9 +1,10 @@ # Zebra indexes as referred to from the *.abs-files. -# $Id: default.idx,v 1.5 1998-09-22 10:03:47 adam Exp $ +# $Id: default.idx,v 1.6 1999-02-12 13:29:24 adam Exp $ # # Traditional word index index w completeness 0 +position 0 charmap string.chr # Phrase index diff --git a/util/zebramap.c b/util/zebramap.c index d3dc2ed..e787899 100644 --- a/util/zebramap.c +++ b/util/zebramap.c @@ -1,10 +1,13 @@ /* - * Copyright (C) 1994-1998, Index Data + * Copyright (C) 1994-1999, Index Data * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: zebramap.c,v $ - * Revision 1.11 1998-10-13 20:09:19 adam + * Revision 1.12 1999-02-12 13:29:25 adam + * Implemented position-flag for registers. + * + * Revision 1.11 1998/10/13 20:09:19 adam * Changed call to readconf_line. * * Revision 1.10 1998/06/23 15:33:37 adam @@ -58,6 +61,7 @@ struct zebra_map { unsigned reg_id; int completeness; + int positioned; int type; union { struct { @@ -122,6 +126,7 @@ static void zebra_map_read (ZebraMaps zms, const char *name) (*zm)->maptab = NULL; (*zm)->type = ZEBRA_MAP_TYPE_INDEX; (*zm)->completeness = 0; + (*zm)->positioned = 1; } else if (!yaz_matchstr (argv[0], "sort") && argc == 2) { @@ -136,6 +141,7 @@ static void zebra_map_read (ZebraMaps zms, const char *name) (*zm)->u.sort.entry_size = 80; (*zm)->maptab = NULL; (*zm)->completeness = 0; + (*zm)->positioned = 0; } else if (zm && !yaz_matchstr (argv[0], "charmap") && argc == 2) { @@ -145,6 +151,10 @@ static void zebra_map_read (ZebraMaps zms, const char *name) { (*zm)->completeness = atoi (argv[1]); } + else if (zm && !yaz_matchstr (argv[0], "position") && argc == 2) + { + (*zm)->positioned = atoi (argv[1]); + } else if (zm && !yaz_matchstr (argv[0], "entrysize") && argc == 2) { if ((*zm)->type == ZEBRA_MAP_TYPE_SORT) @@ -346,6 +356,14 @@ int zebra_maps_is_complete (ZebraMaps zms, unsigned reg_id) return 0; } +int zebra_maps_is_positioned (ZebraMaps zms, unsigned reg_id) +{ + struct zebra_map *zm = zebra_map_get (zms, reg_id); + if (zm) + return zm->positioned; + return 0; +} + int zebra_maps_is_sort (ZebraMaps zms, unsigned reg_id) { struct zebra_map *zm = zebra_map_get (zms, reg_id);