+void meta_query(int lineno, ZebraHandle zh, char *query, int exphits,
+ zint *ids)
+{
+ ZebraMetaRecord *meta;
+ ODR odr_output = odr_createmem (ODR_ENCODE);
+ const char *setname="rsetname";
+ zint *positions = (zint *) malloc(1 + (exphits * sizeof(zint)));
+ int hits;
+ int i;
+
+ hits = do_query(lineno, zh, query, exphits);
+
+ for (i = 0; i<exphits; i++)
+ positions[i] = i+1;
+
+ meta = zebra_meta_records_create (zh, setname, exphits, positions);
+
+ if (!meta)
+ {
+ printf("Error: retrieve returned error\n%s\n", query);
+ exit (1);
+ }
+
+ for (i = 0; i<exphits; i++)
+ {
+ if (meta[i].sysno != ids[i])
+ {
+ printf("Expected id=" ZINT_FORMAT " but got id=" ZINT_FORMAT,
+ ids[i], meta[i].sysno);
+ exit(1);
+ }
+ }
+ zebra_meta_records_destroy(zh, meta, exphits);
+ odr_destroy (odr_output);
+ free(positions);
+}
+
+struct finfo {
+ const char *name;
+ int occurred;
+};
+
+static void filter_cb(void *cd, const char *name)
+{
+ struct finfo *f = (struct finfo*) cd;
+ if (!strcmp(f->name, name))
+ f->occurred = 1;
+}
+
+void check_filter(ZebraService zs, const char *name)
+{
+ struct finfo f;
+
+ f.name = name;
+ f.occurred = 0;
+ zebra_filter_info(zs, &f, filter_cb);
+ if (!f.occurred)
+ {
+ yaz_log(YLOG_WARN, "Filter %s does not exist.", name);
+ exit(0);
+ }
+}
+
+
+
+