pazpar2  1.14.1
record.h
Go to the documentation of this file.
1 /* This file is part of Pazpar2.
2  Copyright (C) Index Data
3 
4 Pazpar2 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 Pazpar2 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 RECORD_H
21 #define RECORD_H
22 
23 
24 struct client;
25 struct conf_service;
26 
27 union data_types {
28  struct {
29  const char *disp;
30  const char *norm;
31  const char *sort;
32  const char *snippet;
33  } text;
34  struct {
35  int min;
36  int max;
37  } number;
38  double fnumber;
39 };
40 
41 
43  char *name;
44  char *value;
46 };
47 
49  union data_types data;
50  // next item of this name
53 };
54 
55 union data_types * data_types_assign(NMEM nmem,
56  union data_types ** data1,
57  union data_types data2);
58 
59 
60 struct record {
61  struct client *client;
62  // Array mirrors list of metadata fields in config
64  // Array mirrors list of sortkey fields in config
66  // Next in cluster of merged records
67  struct record *next;
68  // client result set position;
69  int position;
70  // score for ranking, either native or our TF/IDF, or other
71  double score;
72  // checksum
73  unsigned checksum;
74 };
75 
76 
77 struct record * record_create(NMEM nmem, int num_metadata, int num_sortkeys,
78  struct client *client, int position);
79 
80 struct record_metadata * record_metadata_create(NMEM nmem);
81 
82 int record_compare(struct record *r1, struct record *r2, struct conf_service *service);
83 
85 {
86  // Array mirrors list of metadata fields in config
89  // char *merge_key;
91 
95  // Set-specific ID for this record
96  char *recid;
100  struct record *records;
103 };
104 
105 #endif // RECORD_H
106 
107 /*
108  * Local variables:
109  * c-basic-offset: 4
110  * c-file-style: "Stroustrup"
111  * indent-tabs-mode: nil
112  * End:
113  * vim: shiftwidth=4 tabstop=8 expandtab
114  */
115 
struct record * record_create(NMEM nmem, int num_metadata, int num_sortkeys, struct client *client, int position)
Definition: record.c:54
int record_compare(struct record *r1, struct record *r2, struct conf_service *service)
Definition: record.c:101
struct record_metadata * record_metadata_create(NMEM nmem)
Definition: record.c:91
union data_types * data_types_assign(NMEM nmem, union data_types **data1, union data_types data2)
Definition: record.c:33
Represents client state for a connection to one search target.
Definition: client.c:99
int retrieval_position
Definition: record.h:97
struct record_metadata ** metadata
Definition: record.h:87
WRBUF relevance_explain2
Definition: record.h:99
union data_types ** sortkeys
Definition: record.h:88
float * term_frequency_vecf
Definition: record.h:94
WRBUF relevance_explain1
Definition: record.h:98
struct reclist_sortparms * sort_parms
Definition: record.h:102
struct record_cluster * sorted_next
Definition: record.h:101
struct record_metadata_attr * merge_keys
Definition: record.h:90
int relevance_score
Definition: record.h:92
int * term_frequency_vec
Definition: record.h:93
struct record * records
Definition: record.h:100
char * recid
Definition: record.h:96
struct record_metadata_attr * next
Definition: record.h:45
union data_types data
Definition: record.h:49
struct record_metadata * next
Definition: record.h:51
struct record_metadata_attr * attributes
Definition: record.h:52
Definition: record.h:60
union data_types ** sortkeys
Definition: record.h:65
int position
Definition: record.h:69
struct record * next
Definition: record.h:67
struct client * client
Definition: record.h:61
struct record_metadata ** metadata
Definition: record.h:63
unsigned checksum
Definition: record.h:73
double score
Definition: record.h:71
const char * norm
Definition: record.h:30
double fnumber
Definition: record.h:38
const char * snippet
Definition: record.h:32
const char * sort
Definition: record.h:31
struct data_types::@3 text
int max
Definition: record.h:36
struct data_types::@4 number
const char * disp
Definition: record.h:29
int min
Definition: record.h:35