IDZEBRA 2.2.8
recctrl.h
Go to the documentation of this file.
1/* This file is part of the Zebra server.
2 Copyright (C) Index Data
3
4Zebra is free software; you can redistribute it and/or modify it under
5the terms of the GNU General Public License as published by the Free
6Software Foundation; either version 2, or (at your option) any later
7version.
8
9Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10WARRANTY; without even the implied warranty of MERCHANTABILITY or
11FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
18*/
19
20#ifndef IDZEBRA_RECCTRL_H
21#define IDZEBRA_RECCTRL_H
22
23#include <sys/types.h>
24#include <yaz/proto.h>
25#include <yaz/odr.h>
26#include <idzebra/res.h>
27#include <idzebra/data1.h>
28#include <idzebra/snippet.h>
29
30YAZ_BEGIN_CDECL
31
32/* 1 */
33#define ZEBRA_XPATH_ELM_BEGIN "_XPATH_BEGIN"
34
35/* 2 */
36#define ZEBRA_XPATH_ELM_END "_XPATH_END"
37
38/* 1016 */
39#define ZEBRA_XPATH_CDATA "_XPATH_CDATA"
40
41/* 3 */
42#define ZEBRA_XPATH_ATTR_NAME "_XPATH_ATTR_NAME"
43
44/* 1015 */
45#define ZEBRA_XPATH_ATTR_CDATA "_XPATH_ATTR_CDATA"
46
47#define ZEBRA_GROUP_INDEX_NAME "_GROUP_"
48
69
73 void *fh;
75 int (*readf)(struct ZebraRecStream *s, char *buf, size_t count);
77 off_t (*seekf)(struct ZebraRecStream *s, off_t offset);
79 off_t (*tellf)(struct ZebraRecStream *s);
81 off_t (*endf)(struct ZebraRecStream *s, off_t *offset);
83 void (*destroy)(struct ZebraRecStream *s);
84};
85
99
103 void (*init)(struct recExtractCtrl *p, RecWord *w);
105 void (*tokenAdd)(RecWord *w);
106 void (*setStoreData)(struct recExtractCtrl *p, void *buf, size_t size);
109 char match_criteria[256];
111 void (*schemaAdd)(struct recExtractCtrl *p, Odr_oid *oid);
113 void *handle;
115};
116
117/* Retrieve record control */
120 /* Input parameters ... */
121 Res res; /* Resource pool */
122 ODR odr; /* ODR used to create response */
123 const Odr_oid * input_format; /* Preferred record syntax OID */
124 Z_RecordComposition *comp; /* formatting instructions */
125 char *encoding; /* preferred character encoding */
126 zint localno; /* local id of record */
127 int score; /* score 0-1000 or -1 if none */
128 zint staticrank; /* static rank >= 0, 0 if none */
129 int recordSize; /* size of record in bytes */
130 char *fname; /* name of file (or NULL if internal) */
132
133 /* response */
134 const Odr_oid * output_format; /* output format OID */
135 void * rec_buf;
138 char * addinfo;
139
140 /* special fetch to be included in retrieved response (say snippets) */
141 void *handle;
142 int (*special_fetch)(void *handle, const char *esn,
143 const Odr_oid *input_format,
144 const Odr_oid **output_format,
145 WRBUF result, WRBUF addinfo);
146};
147
148typedef struct recType *RecType;
149
151{
153 char *name; /* Name of record type */
154 void *(*init)(Res res, RecType recType); /* Init function - called once */
155 ZEBRA_RES (*config)(void *clientData, Res res, const char *args); /* Config */
156 void (*destroy)(void *clientData); /* Destroy function */
157 int (*extract)(void *clientData,
158 struct recExtractCtrl *ctrl); /* Extract proc */
159 int (*retrieve)(void *clientData,
160 struct recRetrieveCtrl *ctrl); /* Retrieve proc */
161};
162
163#define RECCTRL_EXTRACT_OK 0
164#define RECCTRL_EXTRACT_EOF 1
165#define RECCTRL_EXTRACT_ERROR_GENERIC 2
166#define RECCTRL_EXTRACT_ERROR_NO_SUCH_FILTER 3
167#define RECCTRL_EXTRACT_SKIP 4
168
170typedef struct recTypes *RecTypes;
171
172YAZ_EXPORT
173RecTypeClass recTypeClass_create (Res res, NMEM nmem);
174
175YAZ_EXPORT
176void recTypeClass_load_modules(RecTypeClass *rts, NMEM nmem,
177 const char *module_path);
178
179YAZ_EXPORT
181 const char *module_path);
182
183YAZ_EXPORT
185
186YAZ_EXPORT
187void recTypeClass_info(RecTypeClass rtc, void *cd,
188 void (*cb)(void *cd, const char *s));
189
190YAZ_EXPORT
192
193YAZ_EXPORT
195
196YAZ_EXPORT
198
199YAZ_EXPORT
200RecType recType_byName(RecTypes rts, Res res, const char *name,
201 void **clientDataP);
202
203YAZ_END_CDECL
204
205#endif
206/*
207 * Local variables:
208 * c-basic-offset: 4
209 * c-file-style: "Stroustrup"
210 * indent-tabs-mode: nil
211 * End:
212 * vim: shiftwidth=4 tabstop=8 expandtab
213 */
214
void recTypeClass_load_modules(RecTypeClass *rts, NMEM nmem, const char *module_path)
Definition recctrl.c:177
RecTypeClass recTypeClass_add_modules(Res res, NMEM nmem, const char *module_path)
struct recType * RecType
Definition recctrl.h:148
void recTypeClass_destroy(RecTypeClass rtc)
Definition recctrl.c:223
zebra_recctrl_action_t
Definition recctrl.h:87
@ action_a_delete
Definition recctrl.h:97
@ action_delete
Definition recctrl.h:93
@ action_insert
Definition recctrl.h:89
@ action_update
Definition recctrl.h:95
@ action_replace
Definition recctrl.h:91
struct recTypes * RecTypes
Definition recctrl.h:170
RecTypeClass recTypeClass_create(Res res, NMEM nmem)
Definition recctrl.c:58
void recTypes_destroy(RecTypes recTypes)
Definition recctrl.c:253
struct recTypeClass * RecTypeClass
Definition recctrl.h:169
void recTypeClass_info(RecTypeClass rtc, void *cd, void(*cb)(void *cd, const char *s))
Definition recctrl.c:216
RecTypes recTypes_init(RecTypeClass rtc, data1_handle dh)
Definition recctrl.c:234
RecType recType_byName(RecTypes rts, Res res, const char *name, void **clientDataP)
Definition recctrl.c:264
void recTypes_default_handlers(RecTypes recTypes, Res res)
const char * term_buf
Definition recctrl.h:56
zint record_id
Definition recctrl.h:64
const char * index_type
Definition recctrl.h:52
struct recExtractCtrl * extractCtrl
Definition recctrl.h:67
zint seqno
Definition recctrl.h:60
int term_len
Definition recctrl.h:58
zint section_id
Definition recctrl.h:66
zint segment
Definition recctrl.h:62
const char * index_name
Definition recctrl.h:54
record reader stream
Definition recctrl.h:71
void(* destroy)(struct ZebraRecStream *s)
close and destroy stream
Definition recctrl.h:83
off_t(* seekf)(struct ZebraRecStream *s, off_t offset)
seek function
Definition recctrl.h:77
off_t(* endf)(struct ZebraRecStream *s, off_t *offset)
set and get of record position
Definition recctrl.h:81
int(* readf)(struct ZebraRecStream *s, char *buf, size_t count)
read function
Definition recctrl.h:75
void * fh
Definition recctrl.h:73
off_t(* tellf)(struct ZebraRecStream *s)
tell function
Definition recctrl.h:79
record extract for indexing
Definition recctrl.h:101
void * clientData
Definition recctrl.h:104
int flagShowRecords
Definition recctrl.h:108
void(* init)(struct recExtractCtrl *p, RecWord *w)
Definition recctrl.h:103
enum zebra_recctrl_action_t action
Definition recctrl.h:114
char match_criteria[256]
Definition recctrl.h:109
void(* tokenAdd)(RecWord *w)
Definition recctrl.h:105
zint staticrank
Definition recctrl.h:110
void * handle
Definition recctrl.h:113
void(* setStoreData)(struct recExtractCtrl *p, void *buf, size_t size)
Definition recctrl.h:106
void(* schemaAdd)(struct recExtractCtrl *p, Odr_oid *oid)
Definition recctrl.h:111
data1_handle dh
Definition recctrl.h:112
struct ZebraRecStream * stream
Definition recctrl.h:102
const Odr_oid * input_format
Definition recctrl.h:123
data1_handle dh
Definition recctrl.h:131
int(* special_fetch)(void *handle, const char *esn, const Odr_oid *input_format, const Odr_oid **output_format, WRBUF result, WRBUF addinfo)
Definition recctrl.h:142
char * addinfo
Definition recctrl.h:138
Z_RecordComposition * comp
Definition recctrl.h:124
struct ZebraRecStream * stream
Definition recctrl.h:119
const Odr_oid * output_format
Definition recctrl.h:134
void * handle
Definition recctrl.h:141
char * encoding
Definition recctrl.h:125
void * rec_buf
Definition recctrl.h:135
int(* retrieve)(void *clientData, struct recRetrieveCtrl *ctrl)
Definition recctrl.h:159
void(* destroy)(void *clientData)
Definition recctrl.h:156
int(* extract)(void *clientData, struct recExtractCtrl *ctrl)
Definition recctrl.h:157
int version
Definition recctrl.h:152
char * name
Definition recctrl.h:153
ZEBRA_RES(* config)(void *clientData, Res res, const char *args)
Definition recctrl.h:155
data1_handle dh
Definition recctrl.c:50
long zint
Zebra integer.
Definition util.h:66
short ZEBRA_RES
Common return type for Zebra API.
Definition util.h:80