IDZEBRA  2.1.2
rank.h
Go to the documentation of this file.
1 /* This file is part of the Zebra server.
2  Copyright (C) Index Data
3 
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8 
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 
18 */
19 
20 #ifndef RANK_H
21 #define RANK_H
22 
23 #include <idzebra/api.h>
24 
25 YAZ_BEGIN_CDECL
26 
27 struct rank_control {
28  char *name;
29  void *(*create)(ZebraHandle zh);
30  void (*destroy)(struct zebra_register *reg, void *class_handle);
31  void *(*begin)(struct zebra_register *reg,
32  void *class_handle, RSET rset, NMEM nmem,
33  TERMID *terms, int numterms);
34  /* ### Could add parameters to begin:
35  * char *index; // author, title, etc.
36  * int dbsize; // number of records in database
37  * int rssize; // number of records in result set (estimate?)
38  */
39  void (*end)(struct zebra_register *reg, void *set_handle);
40  int (*calc)(void *set_handle, zint sysno, zint staticrank,
41  int *stop_flag);
42  void (*add)(void *set_handle, int seqno, TERMID term);
43 };
44 
45 void zebraRankInstall (struct zebra_register *reg, struct rank_control *ctrl);
47 void zebraRankDestroy (struct zebra_register *reg);
48 
49 /* declaring externally defined rank class structures */
50 /* remember to install rank classes in zebraapi.c as well!! */
51 extern struct rank_control *rank_1_class;
52 extern struct rank_control *rank_2_class;
53 extern struct rank_control *rank_zv_class;
54 extern struct rank_control *rank_static_class;
55 extern struct rank_control *rank_similarity_class;
56 
57 
58 
59 YAZ_END_CDECL
60 
61 #endif
62 /*
63  * Local variables:
64  * c-basic-offset: 4
65  * c-file-style: "Stroustrup"
66  * indent-tabs-mode: nil
67  * End:
68  * vim: shiftwidth=4 tabstop=8 expandtab
69  */
70 
Zebra API.
void(* destroy)(struct zebra_register *reg, void *class_handle)
Definition: rank.h:30
struct rset rset
void(* add)(void *set_handle, int seqno, TERMID term)
Definition: rank.h:42
ZebraRankClass zebraRankLookup(ZebraHandle zh, const char *name)
Definition: zsets.c:1193
ZebraHandle zh
Definition: zebrash.c:64
struct rank_control * rank_2_class
Definition: rank1.c:266
char * name
Definition: rank.h:28
struct rank_control * rank_static_class
Definition: rankstatic.c:185
int(* calc)(void *set_handle, zint sysno, zint staticrank, int *stop_flag)
Definition: rank.h:40
void(* end)(struct zebra_register *reg, void *set_handle)
Definition: rank.h:39
struct rank_control * rank_zv_class
long zint
Zebra integer.
Definition: util.h:66
struct rank_control * rank_1_class
Definition: rank1.c:254
int stop_flag
Definition: index.h:148
Definition: rset.h:150
void zebraRankDestroy(struct zebra_register *reg)
Definition: zsets.c:1218
struct rank_control * rank_similarity_class
Definition: rset.h:50
void zebraRankInstall(struct zebra_register *reg, struct rank_control *ctrl)
Definition: zsets.c:1207