1 /* $Id: t10.c,v 1.8 2005-05-24 11:35:43 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"
28 #define qry(zh,query,hits,string,score) \
29 ranking_query(__LINE__,(zh),(query),(hits),(string),(score))
43 struct tst tests[] = {
44 {"ntc-atn", "first title", 0, "first title", 1000, "first title",1000 },
45 {"ntc-ntn", "first title", 0, "first title", 1000, "first title",1000 },
46 {"ntc-btn", "first title", 0, "first title", 1000, "first title",1000 },
47 {"ntc-apn", "first title", 0, "first title", 1000, "first title",1000 },
48 {"ntc-npn", "first title", 0, "first title", 1000, "first title",1000 },
49 {"ntc-bpn", "first title", 0, "first title", 1000, "first title",1000 },
50 {"atc-atn", "first title", 0, "first title", 1000, "first title", 1000 },
51 {"atc-ntn", "first title", 0, "first title", 1000, "first title", 1000 },
52 {"atc-btn", "first title", 0, "first title", 1000, "first title", 1000 },
53 {"atc-apn", "first title", 0, "first title", 1000, "first title", 1000 },
54 {"atc-npn", "first title", 0, "first title", 1000, "first title", 1000 },
55 {"atc-bpn", "first title", 0, "first title", 1000, "first title", 1000 },
57 {"npc-atn", "first title", 0, "first title", 1000, "first title", 1000 },
58 {"npc-ntn", "first title", 0, "first title", 1000, "first title", 1000 },
59 {"npc-btn", "first title", 0, "first title", 1000, "first title", 1000 },
60 {"npc-apn", "first title", 0, "first title", 1000, "first title", 1000 },
61 {"npc-npn", "first title", 0, "first title", 1000, "first title", 1000 },
62 {"npc-bpn", "first title", 0, "first title", 1000, "first title", 1000 },
64 {"apc-atn", "first title", 0, "first title", 1000, "first title", 1000 },
65 {"apc-ntn", "first title", 0, "first title", 1000, "first title", 1000 },
66 {"apc-btn", "first title", 0, "first title", 1000, "first title", 1000 },
67 {"apc-apn", "first title", 0, "first title", 1000, "first title", 1000 },
68 {"apc-npn", "first title", 0, "first title", 1000, "first title", 1000 },
69 {"apc-bpn", "first title", 0, "first title", 1000, "first title", 1000 },
73 int main(int argc, char **argv)
76 ZebraService zs = start_up("zebrazv.cfg", argc, argv);
77 ZebraHandle zh = zebra_open (zs);
81 for (i = 0; tests[i].schema; i++)
84 zebra_select_database(zh, "Default");
85 zebra_set_resource(zh, "zvrank.weighting-scheme", tests[i].schema);
86 yaz_log(YLOG_LOG,"============%d: %s ===========", i, tests[i].schema);
88 ranking_query( __LINE__, zh, "@attr 1=1016 @attr 2=102 the",
89 3, tests[i].hit1, tests[i].score1);
90 ranking_query( __LINE__, zh, "@attr 1=1016 @attr 2=102 @or foo bar",
91 3, tests[i].hit2, tests[i].score2);
92 ranking_query( __LINE__, zh,
93 "@attr 1=1016 @attr 2=102 @or @or the foo bar",
94 3, tests[i].hit3, tests[i].score3);
99 return close_down(0,zs,0);