+ return 1;
+}
+
+int tl_sort(ZebraHandle zh, const char *query, zint hits, zint *exp)
+{
+ ZebraMetaRecord *recs;
+ zint i;
+ int errs = 0;
+ zint min_val_recs = 0;
+ zint min_val_exp = 0;
+
+ assert(query);
+ if (!tl_query(zh, query, hits))
+ return 0;
+
+ recs = zebra_meta_records_create_range (zh, "rsetname", 1, 4);
+ if (!recs)
+ return 0;
+
+ /* find min for each sequence to get proper base offset */
+ for (i = 0; i<hits; i++)
+ {
+ if (min_val_recs == 0 || recs[i].sysno < min_val_recs)
+ min_val_recs = recs[i].sysno;
+ if (min_val_exp == 0 || exp[i] < min_val_exp)
+ min_val_exp = exp[i];
+ }
+
+ /* compare sequences using base offset */
+ for (i = 0; i<hits; i++)
+ if ((recs[i].sysno-min_val_recs) != (exp[i]-min_val_exp))
+ errs++;
+ if (errs)
+ {
+ printf("Sequence not in right order for query\n%s\ngot exp\n",
+ query);
+ for (i = 0; i<hits; i++)
+ printf(" " ZINT_FORMAT " " ZINT_FORMAT "\n",
+ recs[i].sysno, exp[i]);
+ }
+ zebra_meta_records_destroy (zh, recs, 4);
+
+ if (errs)
+ return 0;
+ return 1;