added first shot on relevance ranking testing, still incomplete and segfaulting.
[pazpar2-moved-to-github.git] / src / test_relevance.c
1 /* $Id: test_relevance.c,v 1.1 2007-04-16 13:58:20 marc Exp $
2    Copyright (c) 2006-2007, Index Data.
3
4 This file is part of Pazpar2.
5
6 Pazpar2 is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Pazpar2; see the file LICENSE.  If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.
20  */
21
22 #include <stdlib.h>
23 #include <stdio.h>
24 #include <string.h>
25 #include <sys/time.h>
26 #include <unistd.h>
27 #include <sys/socket.h>
28 #include <netdb.h>
29 #include <signal.h>
30 #include <ctype.h>
31 #include <assert.h>
32
33 #if HAVE_CONFIG_H
34 #include "cconfig.h"
35 #endif
36
37 #define USE_TIMING 0
38 #if USE_TIMING
39 #include <yaz/timing.h>
40 #endif
41
42 #include <yaz/test.h>
43
44
45 //#include "pazpar2.h"
46 #include "relevance.h"
47
48
49
50
51
52
53
54
55 void test_relevance(int argc, char **argv)
56 {
57   NMEM  nmem = nmem_create();
58   struct conf_service service; 
59   struct record record;
60   struct reclist list;
61   struct record_cluster *cluster = 0;
62   struct relevance *rel = 0;
63   int numrecs = 10;
64   char mergekey[128];
65   //const char * terms[] = 
66   //    {"ål",  "abe", "økologi", "fisk", "æble", "yoghurt"};
67   const char * terms[] = 
68       {"abe", "fisk"};
69   int total = 0;
70   struct record_metadata *metadata = 0;
71   
72
73   relevance_create(nmem, terms, numrecs);
74
75   relevance_prepare_read(rel, &list); 
76
77   cluster = reclist_insert(&service, &list, &record, mergekey, &total);
78
79   //relevance_newrec(rel, cluster);
80
81   //relevance_donerecord(se->relevance, cluster);
82   //          relevance_countwords(se->relevance, cluster, 
83   //                                   (char *) value, md->rank);
84   //      
85
86   nmem_destroy(nmem);
87
88   YAZ_CHECK(0 == 0);
89   //YAZ_CHECK_EQ(0, 1);
90
91   
92
93 }
94
95
96 int main(int argc, char **argv)
97 {
98     YAZ_CHECK_INIT(argc, argv); 
99     YAZ_CHECK_LOG(); 
100
101
102     test_relevance(argc, argv); 
103
104     
105     YAZ_CHECK_TERM;
106 }
107
108
109
110
111 /*
112  * Local variables:
113  * c-basic-offset: 4
114  * indent-tabs-mode: nil
115  * End:
116  * vim: shiftwidth=4 tabstop=8 expandtab
117  */