1 /* $Id: t10.c,v 1.11 2006-05-10 08:13:35 adam Exp $
2 Copyright (C) 1995-2005
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /** t10.c - test zv-rank */
26 #include "rankingrecords.h"
38 struct tst tests[] = {
39 {"ntc-atn", "first title", 0, "first title", 1000, "first title",1000 },
40 {"ntc-ntn", "first title", 0, "first title", 1000, "first title",1000 },
41 {"ntc-btn", "first title", 0, "first title", 1000, "first title",1000 },
42 {"ntc-apn", "first title", 0, "first title", 1000, "first title",1000 },
43 {"ntc-npn", "first title", 0, "first title", 1000, "first title",1000 },
44 {"ntc-bpn", "first title", 0, "first title", 1000, "first title",1000 },
45 {"atc-atn", "first title", 0, "first title", 1000, "first title", 1000 },
46 {"atc-ntn", "first title", 0, "first title", 1000, "first title", 1000 },
47 {"atc-btn", "first title", 0, "first title", 1000, "first title", 1000 },
48 {"atc-apn", "first title", 0, "first title", 1000, "first title", 1000 },
49 {"atc-npn", "first title", 0, "first title", 1000, "first title", 1000 },
50 {"atc-bpn", "first title", 0, "first title", 1000, "first title", 1000 },
52 {"npc-atn", "first title", 0, "first title", 1000, "first title", 1000 },
53 {"npc-ntn", "first title", 0, "first title", 1000, "first title", 1000 },
54 {"npc-btn", "first title", 0, "first title", 1000, "first title", 1000 },
55 {"npc-apn", "first title", 0, "first title", 1000, "first title", 1000 },
56 {"npc-npn", "first title", 0, "first title", 1000, "first title", 1000 },
57 {"npc-bpn", "first title", 0, "first title", 1000, "first title", 1000 },
59 {"apc-atn", "first title", 0, "first title", 1000, "first title", 1000 },
60 {"apc-ntn", "first title", 0, "first title", 1000, "first title", 1000 },
61 {"apc-btn", "first title", 0, "first title", 1000, "first title", 1000 },
62 {"apc-apn", "first title", 0, "first title", 1000, "first title", 1000 },
63 {"apc-npn", "first title", 0, "first title", 1000, "first title", 1000 },
64 {"apc-bpn", "first title", 0, "first title", 1000, "first title", 1000 },
68 static void tst(int argc, char **argv)
71 ZebraService zs = tl_start_up("zebrazv.cfg", argc, argv);
72 ZebraHandle zh = zebra_open(zs, 0);
74 YAZ_CHECK(tl_init_data(zh, recs));
76 for (i = 0; tests[i].schema; i++)
78 zh = zebra_open(zs, 0);
80 YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK);
82 zebra_set_resource(zh, "zvrank.weighting-scheme", tests[i].schema);
83 yaz_log(YLOG_LOG,"============%d: %s ===========", i, tests[i].schema);
85 YAZ_CHECK(tl_ranking_query(zh, "@attr 1=1016 @attr 2=102 the",
86 3, tests[i].hit1, tests[i].score1));
87 YAZ_CHECK(tl_ranking_query(zh, "@attr 1=1016 @attr 2=102 @or foo bar",
88 3, tests[i].hit2, tests[i].score2));
89 YAZ_CHECK(tl_ranking_query(zh,
90 "@attr 1=1016 @attr 2=102 @or @or the foo bar",
91 3, tests[i].hit3, tests[i].score3));
94 YAZ_CHECK(tl_close_down(0, zs));
101 * indent-tabs-mode: nil
103 * vim: shiftwidth=4 tabstop=8 expandtab