The record ID (recid) that Pazpar2 generates is now the merge key and not
[pazpar2-moved-to-github.git] / src / reclists.h
1 /* $Id: reclists.h,v 1.11 2007-07-16 17:01:46 adam 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 #ifndef RECLISTS_H
23 #define RECLISTS_H
24
25 #include "config.h"
26 #include "record.h"
27
28 struct reclist
29 {
30     struct reclist_bucket **hashtable;
31     int hashtable_size;
32     int hashmask;
33
34     struct record_cluster **flatlist;
35     int flatlist_size;
36     int num_records;
37     int pointer;
38
39     NMEM nmem;
40 };
41
42 // This is a recipe for sorting. First node in list has highest priority
43 struct reclist_sortparms
44 {
45     int offset;
46     enum conf_sortkey_type type;
47     int increasing;
48     struct reclist_sortparms *next;
49 };
50
51 struct reclist_sortparms * 
52 reclist_sortparms_insert_field_id(NMEM nmem,
53                                   struct reclist_sortparms **sortparms,
54                                   int field_id ,
55                                   enum conf_sortkey_type type,
56                                   int increasing);
57
58
59 struct reclist_sortparms * 
60 reclist_sortparms_insert(NMEM nmem, 
61                          struct reclist_sortparms **sortparms,
62                          struct conf_service * service,
63                          const char * name,
64                          int increasing);
65
66
67 struct reclist *reclist_create(NMEM, int numrecs);
68 struct record_cluster *reclist_insert( struct reclist *tl,
69                                        struct conf_service *service,
70                                        struct record  *record,
71                                        char *merge_key, int *total);
72 void reclist_sort(struct reclist *l, struct reclist_sortparms *parms);
73 struct record_cluster *reclist_read_record(struct reclist *l);
74 void reclist_rewind(struct reclist *l);
75 struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms);
76
77 #endif
78
79 /*
80  * Local variables:
81  * c-basic-offset: 4
82  * indent-tabs-mode: nil
83  * End:
84  * vim: shiftwidth=4 tabstop=8 expandtab
85  */