Get rid of record_assign_client
[pazpar2-moved-to-github.git] / src / record.h
1 /* $Id: record.h,v 1.9 2007-06-07 12:27:03 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 RECORD_H
23 #define RECORD_H
24
25
26 struct record;
27 struct client;
28 struct conf_service;
29
30 union data_types {
31     char *text;
32     struct {
33         int min;
34         int max;
35     } number;
36 };
37
38
39
40 struct record_metadata {
41     union data_types data;
42     // next item of this name
43     struct record_metadata *next; 
44 };
45
46 union data_types * data_types_assign(NMEM nmem, 
47                                      union data_types ** data1, 
48                                      union data_types data2);
49
50
51 struct record {
52     struct client *client;
53     // Array mirrors list of metadata fields in config
54     struct record_metadata **metadata; 
55     // Array mirrors list of sortkey fields in config
56     union data_types **sortkeys;
57     // Next in cluster of merged records       
58     struct record *next;  
59 };
60
61
62 struct record * record_create(NMEM nmem, int num_metadata, int num_sortkeys,
63                               struct client *client);
64
65 struct record_metadata * record_metadata_create(NMEM nmem);
66
67 struct record_metadata * record_metadata_insert(NMEM nmem, 
68                                                 struct record_metadata ** rmd,
69                                                 union data_types data);
70
71
72 struct record_metadata * record_add_metadata_field_id(NMEM nmem, 
73                                                       struct record * record,
74                                                       int field_id, 
75                                                       union data_types data);
76
77
78 struct record_metadata * record_add_metadata(NMEM nmem, 
79                                              struct record * record,
80                                              struct conf_service * service,
81                                              const char * name,
82                                              union data_types data);
83
84
85 union data_types * record_assign_sortkey_field_id(NMEM nmem, 
86                                                struct record * record,
87                                                int field_id, 
88                                                union data_types data);
89
90
91 union data_types * record_assign_sortkey(NMEM nmem, 
92                                       struct record * record,
93                                       struct conf_service * service,
94                                       const char * name,
95                                       union data_types data);
96
97
98
99
100 struct record_cluster
101 {
102     // Array mirrors list of metadata fields in config
103     struct record_metadata **metadata; 
104     union data_types **sortkeys;
105     char *merge_key;
106     int relevance;
107     int *term_frequency_vec;
108     // Set-specific ID for this record
109     int recid; 
110     struct record *records;
111 };
112
113
114
115
116 #endif // RECORD_H
117
118 /*
119  * Local variables:
120  * c-basic-offset: 4
121  * indent-tabs-mode: nil
122  * End:
123  * vim: shiftwidth=4 tabstop=8 expandtab
124  */