62134dc545a2ee8f03aa0a280e7e24470d3b6603
[idzebra-moved-to-github.git] / index / rank.h
1 /* $Id: rank.h,v 1.4 2007-01-15 20:08:25 adam Exp $
2    Copyright (C) 1995-2007
3    Index Data ApS
4
5 This file is part of the Zebra server.
6
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
10 version.
11
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
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
21 */
22
23 #ifndef RANK_H
24 #define RANK_H
25
26 #include <idzebra/api.h>
27
28 YAZ_BEGIN_CDECL
29
30 struct rank_control {
31     char *name;
32     void *(*create)(ZebraHandle zh);
33     void (*destroy)(struct zebra_register *reg, void *class_handle);
34     void *(*begin)(struct zebra_register *reg, 
35                    void *class_handle, RSET rset, NMEM nmem,
36                    TERMID *terms, int numterms);
37     /* ### Could add parameters to begin:
38      *  char *index;    // author, title, etc.
39      *  int dbsize;     // number of records in database
40      *  int rssize;     // number of records in result set (estimate?)
41      */
42     void (*end)(struct zebra_register *reg, void *set_handle);
43     int (*calc)(void *set_handle, zint sysno, zint staticrank,
44                 int *stop_flag);
45     void (*add)(void *set_handle, int seqno, TERMID term);
46 };
47
48 void zebraRankInstall (struct zebra_register *reg, struct rank_control *ctrl);
49 ZebraRankClass zebraRankLookup (ZebraHandle zh, const char *name);
50 void zebraRankDestroy (struct zebra_register *reg);
51
52 /* declaring externally defined rank class structures */
53 /* remember to install rank classes in zebraapi.c as well!! */
54 extern struct rank_control *rank_1_class;
55 extern struct rank_control *rank_zv_class;
56 extern struct rank_control *rank_static_class;
57 extern struct rank_control *rank_similarity_class;
58
59
60
61 YAZ_END_CDECL
62
63 #endif
64 /*
65  * Local variables:
66  * c-basic-offset: 4
67  * indent-tabs-mode: nil
68  * End:
69  * vim: shiftwidth=4 tabstop=8 expandtab
70  */
71