+Added numerical sort - triggered by structure=numeric (4=109).
+
Remote record import using Z39.50 Extended Services and Segments.
Fixed bug where updating a database with user-defined attributes
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebramap.h,v $
- * Revision 1.10 1999-11-30 13:48:03 adam
+ * Revision 1.11 2001-01-22 10:42:56 adam
+ * Added numerical sort.
+ *
+ * Revision 1.10 1999/11/30 13:48:03 adam
* Improved installation. Updated for inclusion of YAZ header files.
*
* Revision 1.9 1999/09/07 07:19:21 adam
unsigned *reg_id, char **search_type, char **rank_type,
int *complete_flag, int *sort_flag);
-int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes);
+int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes,
+ int *numerical);
int zebra_maps_is_complete (ZebraMaps zms, unsigned reg_id);
int zebra_maps_is_sort (ZebraMaps zms, unsigned reg_id);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zsets.c,v $
- * Revision 1.28 2000-07-07 12:49:20 adam
+ * Revision 1.29 2001-01-22 10:42:56 adam
+ * Added numerical sort.
+ *
+ * Revision 1.28 2000/07/07 12:49:20 adam
* Optimized resultSetInsert{Rank,Sort}.
*
* Revision 1.27 2000/04/05 09:49:36 adam
struct sortKeyInfo {
int relation;
int attrUse;
+ int numerical;
};
void resultSetInsertSort (ZebraHandle zh, ZebraSet sset,
int rel = 0;
for (j = 0; j<num_criteria; j++)
{
- rel = memcmp (this_entry.buf[j], sort_info->entries[i]->buf[j],
+ if (criteria[j].numerical)
+ {
+ double diff = atof(this_entry.buf[j]) -
+ atof(sort_info->entries[i]->buf[j]);
+ rel = 0;
+ if (diff > 0.0)
+ rel = 1;
+ else if (diff < 0.0)
+ rel = -1;
+ }
+ else
+ {
+ rel = memcmp (this_entry.buf[j], sort_info->entries[i]->buf[j],
SORT_IDX_ENTRYSIZE);
+ }
if (rel)
break;
}
logf (LOG_DEBUG, "Sort: key %d is of type sortAttributes", i+1);
sort_criteria[i].attrUse =
zebra_maps_sort (zh->service->zebra_maps,
- sk->u.sortAttributes);
+ sk->u.sortAttributes,
+ &sort_criteria[i].numerical);
logf (LOG_DEBUG, "use value = %d", sort_criteria[i].attrUse);
if (sort_criteria[i].attrUse == -1)
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebramap.c,v $
- * Revision 1.20 2000-03-02 14:35:19 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
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);
}