+ ids[1] = 24339;
+ YAZ_CHECK(tl_meta_query(zh, "@attr 4=3 @attr 1=any mand", 2, ids));
+
+ /* all except 125062 */
+ limits[0] = 125062;
+ limits[1] = 0;
+ zebra_set_limit(zh, 1, limits);
+
+ ids[0] = 24338;
+ ids[1] = 24339;
+ YAZ_CHECK(tl_meta_query(zh, "@attr 4=3 @attr 1=any mand", 2, ids));
+
+ /* no limit */
+ zebra_set_limit(zh, 1, 0);
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=any mand", 3));
+
+ /* test segments */
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title a", 1));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title b", 1));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title c", 1));
+
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and a b", 1));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and a c", 1));
+
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and c d", 1));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and b f", 1));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and f g", 0));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and g f", 0));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and d g", 0));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and g c", 0));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and c g", 0));
+ YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=title @and c c", 1));
+
+ YAZ_CHECK(tl_close_down(zh, zs));