1 /* $Id: t10.c,v 1.3 2004-10-29 13:02:39 heikki Exp $
2 Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
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", 1000, "first title", 1000, "third title", 826 },
45 {"ntc-ntn", "first title", 1000, "first title", 1000, "third title", 826 },
46 {"ntc-btn", "first title", 1000, "first title", 1000, "third title", 826 },
47 {"ntc-apn", "first title", 1000, "first title", 1000, "third title", 826 },
48 {"ntc-npn", "first title", 1000, "first title", 1000, "third title", 826 },
49 {"ntc-bpn", "first title", 1000, "first title", 1000, "third title", 826 },
51 {"atc-atn", "first title", 1000, "first title", 1000, "first title", 972 },
52 {"atc-ntn", "first title", 1000, "first title", 1000, "first title", 972 },
53 {"atc-btn", "first title", 1000, "first title", 1000, "first title", 972 },
54 {"atc-apn", "first title", 1000, "first title", 1000, "first title", 972 },
55 {"atc-npn", "first title", 1000, "first title", 1000, "first title", 972 },
56 {"atc-bpn", "first title", 1000, "first title", 1000, "first title", 972 },
58 {"npc-atn", "first title", 1000, "first title", 1000, "third title", 826 },
59 {"npc-ntn", "first title", 1000, "first title", 1000, "third title", 826 },
60 {"npc-btn", "first title", 1000, "first title", 1000, "third title", 826 },
61 {"npc-apn", "first title", 1000, "first title", 1000, "third title", 826 },
62 {"npc-npn", "first title", 1000, "first title", 1000, "third title", 826 },
63 {"npc-bpn", "first title", 1000, "first title", 1000, "third title", 826 },
65 {"apc-atn", "first title", 1000, "first title", 1000, "first title", 972 },
66 {"apc-ntn", "first title", 1000, "first title", 1000, "first title", 972 },
67 {"apc-btn", "first title", 1000, "first title", 1000, "first title", 972 },
68 {"apc-apn", "first title", 1000, "first title", 1000, "first title", 972 },
69 {"apc-npn", "first title", 1000, "first title", 1000, "first title", 972 },
70 {"apc-bpn", "first title", 1000, "first title", 1000, "first title", 972 },
75 int main(int argc, char **argv)
78 ZebraService zs = start_up("zebrazv.cfg", argc, argv);
79 ZebraHandle zh = zebra_open (zs);
84 yaz_log_init_level(LOG_ALL);
85 for (i=0; tests[i].schema; i++)
88 zebra_select_database(zh, "Default");
89 zebra_set_resource(zh, "zvrank.weighting-scheme", tests[i].schema);
90 logf(LOG_LOG,"============%d: %s ============", i,tests[i].schema);
92 ranking_query( __LINE__, zh, "@attr 1=1016 @attr 2=102 the",
93 3, tests[i].hit1, tests[i].score1);
94 ranking_query( __LINE__, zh, "@attr 1=1016 @attr 2=102 @or foo bar",
95 3, tests[i].hit2, tests[i].score2);
96 ranking_query( __LINE__, zh,
97 "@attr 1=1016 @attr 2=102 @or @or the foo bar",
98 3, tests[i].hit3, tests[i].score3);
103 return close_down(0,zs,0);