X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fzebramap.c;h=04446fbf541d2d489b431055d53bad6e930faa84;hb=e5ebc859654d84aa9098142b34015648d8e333de;hp=9538f8eb7e7fea6bafb73e8cb7e61957f73bc3a0;hpb=e150e51a7e20a902e9fd2f11f00811f94f67d529;p=idzebra-moved-to-github.git diff --git a/util/zebramap.c b/util/zebramap.c index 9538f8e..04446fb 100644 --- a/util/zebramap.c +++ b/util/zebramap.c @@ -4,7 +4,13 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zebramap.c,v $ - * Revision 1.19 1999-11-30 13:48:04 adam + * Revision 1.21 2001-01-22 10:42:56 adam + * Added numerical sort. + * + * Revision 1.20 2000/03/02 14:35:19 adam + * Added structure year and date. + * + * Revision 1.19 1999/11/30 13:48:04 adam * Improved installation. Updated for inclusion of YAZ header files. * * Revision 1.18 1999/10/15 08:27:46 adam @@ -306,7 +312,7 @@ chrmaptab zebra_charmap_get (ZebraMaps zms, unsigned reg_id) logf (LOG_WARN, "Unknown register type: %c", reg_id); zm->reg_id = reg_id; - zm->maptab_name = NULL; + zm->maptab_name = nmem_strdup (zms->nmem, "@"); zm->maptab = NULL; zm->type = ZEBRA_MAP_TYPE_INDEX; zm->completeness = 0; @@ -492,11 +498,19 @@ int zebra_maps_is_sort (ZebraMaps zms, unsigned reg_id) return 0; } -int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes) +int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes, + int *numerical) { AttrType use; + AttrType structure; + int structure_value; attr_init_AttrList (&use, sortAttributes->list, 1); + attr_init_AttrList (&structure, sortAttributes->list, 4); + *numerical = 0; + structure_value = attr_find (&structure, 0); + if (structure_value == 109) + *numerical = 1; return attr_find (&use, NULL); } @@ -572,6 +586,14 @@ int zebra_maps_attr (ZebraMaps zms, Z_AttributesPlusTerm *zapt, *reg_id = '0'; *search_type = "phrase"; break; + case 4: /* year */ + *reg_id = 'y'; + *search_type = "phrase"; + break; + case 5: /* date */ + *reg_id = 'd'; + *search_type = "phrase"; + break; default: return -1; } @@ -588,7 +610,7 @@ WRBUF zebra_replace(ZebraMaps zms, unsigned reg_id, const char *ex_list, wrbuf_rewind(zms->wrbuf_1); wrbuf_write(zms->wrbuf_1, input_str, input_len); - if (!zm->replace_tokens) + if (!zm || !zm->replace_tokens) return zms->wrbuf_1; #if 0