IDZEBRA 2.2.8
mod_alvis.c
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#if HAVE_CONFIG_H
21#include <config.h>
22#endif
23#include <stdio.h>
24#include <stdlib.h>
25#include <assert.h>
26#include <ctype.h>
27
28#include <yaz/diagbib1.h>
29#include <yaz/tpath.h>
30#include <yaz/oid_db.h>
31#include <yaz/snprintf.h>
32
33#include <libxml/xmlversion.h>
34#include <libxml/parser.h>
35#include <libxml/tree.h>
36#include <libxml/xmlIO.h>
37#include <libxml/xmlreader.h>
38#include <libxslt/transform.h>
39#include <libxslt/xsltutils.h>
40
41#if YAZ_HAVE_EXSLT
42#include <libexslt/exslt.h>
43#endif
44
45#include <idzebra/util.h>
46#include <idzebra/recctrl.h>
47
49 const char *name;
50 const char *identifier;
51 const char *stylesheet;
53 const char *default_schema;
54 /* char default_schema; */
55 xsltStylesheetPtr stylesheet_xsp;
56};
57
59 xmlDocPtr doc;
60 char *fname;
61 char *full_name;
62 const char *profile_path;
64 const char *split_path;
65 ODR odr;
67 xmlTextReaderPtr reader;
68};
69
70#define ZEBRA_SCHEMA_XSLT_NS "http://indexdata.dk/zebra/xslt/1"
71
72#define XML_STRCMP(a,b) strcmp((char*)a, b)
73#define XML_STRLEN(a) strlen((char*)a)
74
76
77static void set_param_str(const char **params, const char *name,
78 const char *value, ODR odr)
79{
80 char *quoted = odr_malloc(odr, 3 + strlen(value));
81 yaz_snprintf(quoted, 3 + strlen(value), "'" ZINT_FORMAT "'", value);
82 while (*params)
83 params++;
84 params[0] = name;
85 params[1] = quoted;
86 params[2] = 0;
87}
88
89static void set_param_int(const char **params, const char *name,
90 zint value, ODR odr)
91{
92 char *quoted = odr_malloc(odr, 30); /* 25 digits enough for 2^64 */
93 yaz_snprintf(quoted, 30, "'" ZINT_FORMAT "'", value);
94 while (*params)
95 params++;
96 params[0] = name;
97 params[1] = quoted;
98 params[2] = 0;
99}
100
101#define ENABLE_INPUT_CALLBACK 0
102
103#if ENABLE_INPUT_CALLBACK
104static int zebra_xmlInputMatchCallback (char const *filename)
105{
106 yaz_log(YLOG_LOG, "match %s", filename);
107 return 0;
108}
109
110static void * zebra_xmlInputOpenCallback (char const *filename)
111{
112 return 0;
113}
114
115static int zebra_xmlInputReadCallback (void * context, char * buffer, int len)
116{
117 return 0;
118}
119
120static int zebra_xmlInputCloseCallback (void * context)
121{
122 return 0;
123}
124#endif
125
126static void *filter_init(Res res, RecType recType)
127{
128 struct filter_info *tinfo = (struct filter_info *) xmalloc(sizeof(*tinfo));
129 tinfo->reader = 0;
130 tinfo->fname = 0;
131 tinfo->full_name = 0;
132 tinfo->profile_path = 0;
133 tinfo->split_level = 0;
134 tinfo->split_path = 0;
135 tinfo->odr = odr_createmem(ODR_ENCODE);
136 tinfo->doc = 0;
137 tinfo->schemas = 0;
138
139#if YAZ_HAVE_EXSLT
140 exsltRegisterAll();
141#endif
142
143#if ENABLE_INPUT_CALLBACK
144 xmlRegisterDefaultInputCallbacks();
145 xmlRegisterInputCallbacks(zebra_xmlInputMatchCallback,
146 zebra_xmlInputOpenCallback,
147 zebra_xmlInputReadCallback,
148 zebra_xmlInputCloseCallback);
149#endif
150 return tinfo;
151}
152
153static int attr_content(struct _xmlAttr *attr, const char *name,
154 const char **dst_content)
155{
156 if (!XML_STRCMP(attr->name, name) && attr->children
157 && attr->children->type == XML_TEXT_NODE)
158 {
159 *dst_content = (const char *)(attr->children->content);
160 return 1;
161 }
162 return 0;
163}
164
165static void destroy_schemas(struct filter_info *tinfo)
166{
167 struct filter_schema *schema = tinfo->schemas;
168 while (schema)
169 {
170 struct filter_schema *schema_next = schema->next;
171 if (schema->stylesheet_xsp)
172 xsltFreeStylesheet(schema->stylesheet_xsp);
173 xfree(schema);
174 schema = schema_next;
175 }
176 tinfo->schemas = 0;
177 xfree(tinfo->fname);
178 if (tinfo->doc)
179 xmlFreeDoc(tinfo->doc);
180 tinfo->doc = 0;
181}
182
183static ZEBRA_RES create_schemas(struct filter_info *tinfo, const char *fname)
184{
185 char tmp_full_name[1024];
186 xmlNodePtr ptr;
187 tinfo->fname = xstrdup(fname);
188
189 if (yaz_filepath_resolve(tinfo->fname, tinfo->profile_path,
190 NULL, tmp_full_name))
191 tinfo->full_name = xstrdup(tmp_full_name);
192 else
193 tinfo->full_name = xstrdup(tinfo->fname);
194
195 yaz_log(YLOG_LOG, "alvis filter: loading config file %s", tinfo->full_name);
196
197 tinfo->doc = xmlParseFile(tinfo->full_name);
198
199 if (!tinfo->doc)
200 {
201 yaz_log(YLOG_WARN, "alvis filter: could not parse config file %s",
202 tinfo->full_name);
203
204 return ZEBRA_FAIL;
205 }
206
207 ptr = xmlDocGetRootElement(tinfo->doc);
208 if (!ptr || ptr->type != XML_ELEMENT_NODE
209 || XML_STRCMP(ptr->name, "schemaInfo"))
210 {
211 yaz_log(YLOG_WARN,
212 "alvis filter: config file %s :"
213 " expected root element <schemaInfo>",
214 tinfo->full_name);
215 return ZEBRA_FAIL;
216 }
217
218 for (ptr = ptr->children; ptr; ptr = ptr->next)
219 {
220 if (ptr->type != XML_ELEMENT_NODE)
221 continue;
222 if (!XML_STRCMP(ptr->name, "schema"))
223 {
224 struct _xmlAttr *attr;
225 struct filter_schema *schema = xmalloc(sizeof(*schema));
226 schema->name = 0;
227 schema->identifier = 0;
228 schema->stylesheet = 0;
229 schema->default_schema = 0;
230 schema->next = tinfo->schemas;
231 schema->stylesheet_xsp = 0;
232 tinfo->schemas = schema;
233 for (attr = ptr->properties; attr; attr = attr->next)
234 {
235 attr_content(attr, "identifier", &schema->identifier);
236 attr_content(attr, "name", &schema->name);
237 attr_content(attr, "stylesheet", &schema->stylesheet);
238 attr_content(attr, "default", &schema->default_schema);
239 }
240 /*yaz_log(YLOG_LOG, "XSLT add %s %s %s",
241 schema->name, schema->identifier, schema->stylesheet); */
242
243 /* find requested schema */
244
245 if (schema->stylesheet)
246 {
247 char tmp_xslt_full_name[1024];
248 if (!yaz_filepath_resolve(schema->stylesheet, tinfo->profile_path,
249 NULL, tmp_xslt_full_name))
250 {
251 yaz_log(YLOG_WARN,
252 "alvis filter: stylesheet %s not found in path %s",
253 schema->stylesheet, tinfo->profile_path);
254 return ZEBRA_FAIL;
255 }
256 schema->stylesheet_xsp
257 = xsltParseStylesheetFile((const xmlChar*) tmp_xslt_full_name);
258 if (!schema->stylesheet_xsp)
259 {
260 yaz_log(YLOG_WARN,
261 "alvis filter: could not parse xslt stylesheet %s",
262 tmp_xslt_full_name);
263 return ZEBRA_FAIL;
264 }
265 }
266 }
267 else if (!XML_STRCMP(ptr->name, "split"))
268 {
269 struct _xmlAttr *attr;
270 for (attr = ptr->properties; attr; attr = attr->next)
271 {
272 const char *split_level_str = 0;
273 attr_content(attr, "level", &split_level_str);
274 tinfo->split_level =
275 split_level_str ? atoi(split_level_str) : 0;
276 }
277 }
278 else
279 {
280 yaz_log(YLOG_WARN, "Bad element %s in %s", ptr->name, fname);
281 return ZEBRA_FAIL;
282 }
283 }
284 return ZEBRA_OK;
285}
286
287static struct filter_schema *lookup_schema(struct filter_info *tinfo,
288 const char *est)
289{
290 struct filter_schema *schema;
291
292 for (schema = tinfo->schemas; schema; schema = schema->next)
293 {
294 /* find requested schema */
295 if (est)
296 {
297 if (schema->identifier && !strcmp(schema->identifier, est))
298 return schema;
299
300 if (schema->name && !strcmp(schema->name, est))
301 return schema;
302 }
303 /* or return default schema if defined */
304 else if (schema->default_schema)
305 return schema;
306 }
307
308 /* return first schema if no default schema defined */
309 if (tinfo->schemas)
310 return tinfo->schemas;
311
312 return 0;
313}
314
315static ZEBRA_RES filter_config(void *clientData, Res res, const char *args)
316{
317 struct filter_info *tinfo = clientData;
318 if (!args || !*args)
319 {
320 yaz_log(YLOG_WARN, "alvis filter: need config file");
321 return ZEBRA_FAIL;
322 }
323
324 if (tinfo->fname && !strcmp(args, tinfo->fname))
325 return ZEBRA_OK;
326
327 tinfo->profile_path = res_get(res, "profilePath");
328 yaz_log(YLOG_LOG, "alvis filter: profilePath %s", tinfo->profile_path);
329
330 destroy_schemas(tinfo);
331 return create_schemas(tinfo, args);
332}
333
334static void filter_destroy(void *clientData)
335{
336 struct filter_info *tinfo = clientData;
337 destroy_schemas(tinfo);
338 xfree(tinfo->full_name);
339 if (tinfo->reader)
340 xmlFreeTextReader(tinfo->reader);
341 odr_destroy(tinfo->odr);
342 xfree(tinfo);
343}
344
345static int ioread_ex(void *context, char *buffer, int len)
346{
347 struct recExtractCtrl *p = context;
348 return p->stream->readf(p->stream, buffer, len);
349}
350
351static int ioclose_ex(void *context)
352{
353 return 0;
354}
355
356static void index_cdata(struct filter_info *tinfo, struct recExtractCtrl *ctrl,
357 xmlNodePtr ptr, RecWord *recWord)
358{
359 for(; ptr; ptr = ptr->next)
360 {
361 index_cdata(tinfo, ctrl, ptr->children, recWord);
362 if (ptr->type != XML_TEXT_NODE)
363 continue;
364 recWord->term_buf = (const char *)ptr->content;
365 recWord->term_len = XML_STRLEN(ptr->content);
366 (*ctrl->tokenAdd)(recWord);
367 }
368}
369
370static void index_node(struct filter_info *tinfo, struct recExtractCtrl *ctrl,
371 xmlNodePtr ptr, RecWord *recWord)
372{
373 for(; ptr; ptr = ptr->next)
374 {
375 index_node(tinfo, ctrl, ptr->children, recWord);
376 if (ptr->type != XML_ELEMENT_NODE || !ptr->ns ||
377 XML_STRCMP(ptr->ns->href, zebra_xslt_ns))
378 continue;
379 if (!XML_STRCMP(ptr->name, "index"))
380 {
381 const char *name_str = 0;
382 const char *type_str = 0;
383 const char *xpath_str = 0;
384 struct _xmlAttr *attr;
385 for (attr = ptr->properties; attr; attr = attr->next)
386 {
387 attr_content(attr, "name", &name_str);
388 attr_content(attr, "xpath", &xpath_str);
389 attr_content(attr, "type", &type_str);
390 }
391 if (name_str)
392 {
393 const char *prev_type = recWord->index_type; /* save default type */
394
395 if (type_str && *type_str)
396 recWord->index_type = (const char *) type_str; /* type was given */
397 recWord->index_name = name_str;
398 index_cdata(tinfo, ctrl, ptr->children, recWord);
399
400 recWord->index_type = prev_type; /* restore it again */
401 }
402 }
403 }
404}
405
406static void index_record(struct filter_info *tinfo,struct recExtractCtrl *ctrl,
407 xmlNodePtr ptr, RecWord *recWord)
408{
409 const char *type_str = "update";
410
411 if (ptr && ptr->type == XML_ELEMENT_NODE && ptr->ns &&
412 !XML_STRCMP(ptr->ns->href, zebra_xslt_ns)
413 && !XML_STRCMP(ptr->name, "record"))
414 {
415 const char *id_str = 0;
416 const char *rank_str = 0;
417 struct _xmlAttr *attr;
418 for (attr = ptr->properties; attr; attr = attr->next)
419 {
420 attr_content(attr, "type", &type_str);
421 attr_content(attr, "id", &id_str);
422 attr_content(attr, "rank", &rank_str);
423 }
424 if (id_str)
425 sscanf(id_str, "%255s", ctrl->match_criteria);
426
427 if (rank_str)
428 ctrl->staticrank = atozint(rank_str);
429 ptr = ptr->children;
430 }
431
432 if (!strcmp("update", type_str))
433 index_node(tinfo, ctrl, ptr, recWord);
434 else if (!strcmp("delete", type_str))
435 yaz_log(YLOG_WARN, "alvis filter delete: to be implemented");
436 else
437 yaz_log(YLOG_WARN, "alvis filter: unknown record type '%s'",
438 type_str);
439}
440
441static int extract_doc(struct filter_info *tinfo, struct recExtractCtrl *p,
442 xmlDocPtr doc)
443{
444 RecWord recWord;
445 const char *params[10];
446 xmlChar *buf_out;
447 int len_out;
448
449 struct filter_schema *schema = lookup_schema(tinfo, zebra_xslt_ns);
450
451 params[0] = 0;
452 set_param_str(params, "schema", zebra_xslt_ns, tinfo->odr);
453
454 (*p->init)(p, &recWord);
455
456 if (schema && schema->stylesheet_xsp)
457 {
458 xmlNodePtr root_ptr;
459 xmlDocPtr resDoc =
460 xsltApplyStylesheet(schema->stylesheet_xsp,
461 doc, params);
462 if (p->flagShowRecords)
463 {
464 xmlDocDumpMemory(resDoc, &buf_out, &len_out);
465 fwrite(buf_out, len_out, 1, stdout);
466 xmlFree(buf_out);
467 }
468 root_ptr = xmlDocGetRootElement(resDoc);
469 if (root_ptr)
470 index_record(tinfo, p, root_ptr, &recWord);
471 else
472 {
473 yaz_log(YLOG_WARN, "No root for index XML record."
474 " split_level=%d stylesheet=%s",
475 tinfo->split_level, schema->stylesheet);
476 }
477 xmlFreeDoc(resDoc);
478 }
479 xmlDocDumpMemory(doc, &buf_out, &len_out);
480 if (p->flagShowRecords)
481 fwrite(buf_out, len_out, 1, stdout);
482 if (p->setStoreData)
483 (*p->setStoreData)(p, buf_out, len_out);
484 xmlFree(buf_out);
485
486 xmlFreeDoc(doc);
487 return RECCTRL_EXTRACT_OK;
488}
489
490static int extract_split(struct filter_info *tinfo, struct recExtractCtrl *p)
491{
492 int ret;
493
494 if (p->first_record)
495 {
496 if (tinfo->reader)
497 xmlFreeTextReader(tinfo->reader);
498 tinfo->reader = xmlReaderForIO(ioread_ex, ioclose_ex,
499 p /* I/O handler */,
500 0 /* URL */,
501 0 /* encoding */,
502 XML_PARSE_XINCLUDE
503 | XML_PARSE_NOENT
504 | XML_PARSE_NONET);
505 }
506 if (!tinfo->reader)
508
509 ret = xmlTextReaderRead(tinfo->reader);
510 while (ret == 1)
511 {
512 int type = xmlTextReaderNodeType(tinfo->reader);
513 int depth = xmlTextReaderDepth(tinfo->reader);
514 if (type == XML_READER_TYPE_ELEMENT && tinfo->split_level == depth)
515 {
516 xmlNodePtr ptr = xmlTextReaderExpand(tinfo->reader);
517 if (ptr)
518 {
519 xmlNodePtr ptr2 = xmlCopyNode(ptr, 1);
520 xmlDocPtr doc = xmlNewDoc((const xmlChar*) "1.0");
521
522 xmlDocSetRootElement(doc, ptr2);
523
524 return extract_doc(tinfo, p, doc);
525 }
526 else
527 {
528 xmlFreeTextReader(tinfo->reader);
529 tinfo->reader = 0;
531 }
532 }
533 ret = xmlTextReaderRead(tinfo->reader);
534 }
535 xmlFreeTextReader(tinfo->reader);
536 tinfo->reader = 0;
537 return RECCTRL_EXTRACT_EOF;
538}
539
540static int extract_full(struct filter_info *tinfo, struct recExtractCtrl *p)
541{
542 if (p->first_record) /* only one record per stream */
543 {
544 xmlDocPtr doc = xmlReadIO(ioread_ex, ioclose_ex, p /* I/O handler */,
545 0 /* URL */,
546 0 /* encoding */,
547 XML_PARSE_XINCLUDE
548 | XML_PARSE_NOENT
549 | XML_PARSE_NONET);
550 if (!doc)
552 /* else {
553 xmlNodePtr root = xmlDocGetRootElement(doc);
554 if (!root)
555 return RECCTRL_EXTRACT_ERROR_GENERIC;
556 } */
557
558 return extract_doc(tinfo, p, doc);
559 }
560 else
561 return RECCTRL_EXTRACT_EOF;
562}
563
564static int filter_extract(void *clientData, struct recExtractCtrl *p)
565{
566 struct filter_info *tinfo = clientData;
567
568 odr_reset(tinfo->odr);
569 if (tinfo->split_level == 0 || p->setStoreData == 0)
570 return extract_full(tinfo, p);
571 else
572 return extract_split(tinfo, p);
573}
574
575static int ioread_ret(void *context, char *buffer, int len)
576{
577 struct recRetrieveCtrl *p = context;
578 return p->stream->readf(p->stream, buffer, len);
579}
580
581static int ioclose_ret(void *context)
582{
583 return 0;
584}
585
586static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
587{
588 /* const char *esn = zebra_xslt_ns; */
589 const char *esn = 0;
590 const char *params[32];
591 struct filter_info *tinfo = clientData;
592 xmlDocPtr resDoc;
593 xmlDocPtr doc;
594 struct filter_schema *schema;
595
596 if (p->comp)
597 {
598 if (p->comp->which == Z_RecordComp_simple
599 && p->comp->u.simple->which == Z_ElementSetNames_generic)
600 {
601 esn = p->comp->u.simple->u.generic;
602 }
603 else if (p->comp->which == Z_RecordComp_complex
604 && p->comp->u.complex->generic->elementSpec
605 && p->comp->u.complex->generic->elementSpec->which ==
606 Z_ElementSpec_elementSetName)
607 {
608 esn = p->comp->u.complex->generic->elementSpec->u.elementSetName;
609 }
610 }
611 schema = lookup_schema(tinfo, esn);
612 if (!schema)
613 {
614 p->diagnostic =
615 YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_;
616 return 0;
617 }
618
619 params[0] = 0;
620 set_param_int(params, "id", p->localno, p->odr);
621 if (p->fname)
622 set_param_str(params, "filename", p->fname, p->odr);
623 if (p->staticrank >= 0)
624 set_param_int(params, "rank", p->staticrank, p->odr);
625
626 if (esn)
627 set_param_str(params, "schema", esn, p->odr);
628 else
629 if (schema->name)
630 set_param_str(params, "schema", schema->name, p->odr);
631 else if (schema->identifier)
632 set_param_str(params, "schema", schema->identifier, p->odr);
633 else
634 set_param_str(params, "schema", "", p->odr);
635
636 if (p->score >= 0)
637 set_param_int(params, "score", p->score, p->odr);
638 set_param_int(params, "size", p->recordSize, p->odr);
639
640 doc = xmlReadIO(ioread_ret, ioclose_ret, p /* I/O handler */,
641 0 /* URL */,
642 0 /* encoding */,
643 XML_PARSE_XINCLUDE | XML_PARSE_NOENT | XML_PARSE_NONET);
644 if (!doc)
645 {
646 p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
647 return 0;
648 }
649
650 if (!schema->stylesheet_xsp)
651 resDoc = doc;
652 else
653 {
654 resDoc = xsltApplyStylesheet(schema->stylesheet_xsp,
655 doc, params);
656 xmlFreeDoc(doc);
657 }
658 if (!resDoc)
659 {
660 p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
661 }
662 else if (!p->input_format
663 || !oid_oidcmp(p->input_format, yaz_oid_recsyn_xml))
664 {
665 xmlChar *buf_out;
666 int len_out;
667
668 if (schema->stylesheet_xsp)
669 xsltSaveResultToString(&buf_out, &len_out, resDoc,
670 schema->stylesheet_xsp);
671 else
672 xmlDocDumpMemory(resDoc, &buf_out, &len_out);
673
674 p->output_format = yaz_oid_recsyn_xml;
675 p->rec_len = len_out;
676 p->rec_buf = odr_malloc(p->odr, p->rec_len);
677 memcpy(p->rec_buf, buf_out, p->rec_len);
678 xmlFree(buf_out);
679 }
680 else if (!oid_oidcmp(p->output_format, yaz_oid_recsyn_sutrs))
681 {
682 xmlChar *buf_out;
683 int len_out;
684
685 if (schema->stylesheet_xsp)
686 xsltSaveResultToString(&buf_out, &len_out, resDoc,
687 schema->stylesheet_xsp);
688 else
689 xmlDocDumpMemory(resDoc, &buf_out, &len_out);
690
691 p->output_format = yaz_oid_recsyn_sutrs;
692 p->rec_len = len_out;
693 p->rec_buf = odr_malloc(p->odr, p->rec_len);
694 memcpy(p->rec_buf, buf_out, p->rec_len);
695
696 xmlFree(buf_out);
697 }
698 else
699 {
700 p->diagnostic = YAZ_BIB1_RECORD_SYNTAX_UNSUPP;
701 }
702 xmlFreeDoc(resDoc);
703 return 0;
704}
705
706static struct recType filter_type = {
707 0,
708 "alvis",
714};
715
717#if IDZEBRA_STATIC_ALVIS
718idzebra_filter_alvis
719#else
721#endif
722
723[] = {
725 0,
726};
727/*
728 * Local variables:
729 * c-basic-offset: 4
730 * c-file-style: "Stroustrup"
731 * indent-tabs-mode: nil
732 * End:
733 * vim: shiftwidth=4 tabstop=8 expandtab
734 */
static void index_cdata(struct filter_info *tinfo, struct recExtractCtrl *ctrl, xmlNodePtr ptr, RecWord *recWord)
Definition mod_alvis.c:356
static void filter_destroy(void *clientData)
Definition mod_alvis.c:334
#define ZEBRA_SCHEMA_XSLT_NS
Definition mod_alvis.c:70
static void * filter_init(Res res, RecType recType)
Definition mod_alvis.c:126
RecType idzebra_filter[]
Definition mod_alvis.c:723
#define XML_STRCMP(a, b)
Definition mod_alvis.c:72
static struct filter_schema * lookup_schema(struct filter_info *tinfo, const char *est)
Definition mod_alvis.c:287
static ZEBRA_RES create_schemas(struct filter_info *tinfo, const char *fname)
Definition mod_alvis.c:183
#define XML_STRLEN(a)
Definition mod_alvis.c:73
static int ioclose_ret(void *context)
Definition mod_alvis.c:581
static struct recType filter_type
Definition mod_alvis.c:706
static int ioclose_ex(void *context)
Definition mod_alvis.c:351
static void set_param_int(const char **params, const char *name, zint value, ODR odr)
Definition mod_alvis.c:89
static int ioread_ret(void *context, char *buffer, int len)
Definition mod_alvis.c:575
static int attr_content(struct _xmlAttr *attr, const char *name, const char **dst_content)
Definition mod_alvis.c:153
static void index_record(struct filter_info *tinfo, struct recExtractCtrl *ctrl, xmlNodePtr ptr, RecWord *recWord)
Definition mod_alvis.c:406
static void set_param_str(const char **params, const char *name, const char *value, ODR odr)
Definition mod_alvis.c:77
static int extract_doc(struct filter_info *tinfo, struct recExtractCtrl *p, xmlDocPtr doc)
Definition mod_alvis.c:441
static void index_node(struct filter_info *tinfo, struct recExtractCtrl *ctrl, xmlNodePtr ptr, RecWord *recWord)
Definition mod_alvis.c:370
static int ioread_ex(void *context, char *buffer, int len)
Definition mod_alvis.c:345
static void destroy_schemas(struct filter_info *tinfo)
Definition mod_alvis.c:165
static int extract_full(struct filter_info *tinfo, struct recExtractCtrl *p)
Definition mod_alvis.c:540
static int extract_split(struct filter_info *tinfo, struct recExtractCtrl *p)
Definition mod_alvis.c:490
static const char * zebra_xslt_ns
Definition mod_alvis.c:75
static ZEBRA_RES filter_config(void *clientData, Res res, const char *args)
Definition mod_alvis.c:315
#define RECCTRL_EXTRACT_EOF
Definition recctrl.h:164
#define RECCTRL_EXTRACT_ERROR_GENERIC
Definition recctrl.h:165
#define RECCTRL_EXTRACT_OK
Definition recctrl.h:163
const char * res_get(Res r, const char *name)
Definition res.c:294
const char * term_buf
Definition recctrl.h:56
const char * index_type
Definition recctrl.h:52
int term_len
Definition recctrl.h:58
const char * index_name
Definition recctrl.h:54
int(* readf)(struct ZebraRecStream *s, char *buf, size_t count)
read function
Definition recctrl.h:75
const char * split_path
Definition mod_alvis.c:64
char * fname
Definition mod_alvis.c:60
int split_level
Definition mod_alvis.c:63
char * full_name
Definition mod_alvis.c:61
struct filter_schema * schemas
Definition mod_alvis.c:66
const char * profile_path
Definition mod_alvis.c:62
xmlDocPtr doc
Definition mod_alvis.c:59
xmlTextReaderPtr reader
Definition mod_alvis.c:67
xsltStylesheetPtr stylesheet_xsp
Definition mod_alvis.c:55
const char * default_schema
Definition mod_alvis.c:53
const char * identifier
Definition mod_alvis.c:50
const char * stylesheet
Definition mod_alvis.c:51
struct filter_schema * next
Definition mod_alvis.c:52
const char * name
Definition mod_alvis.c:49
record extract for indexing
Definition recctrl.h:101
int flagShowRecords
Definition recctrl.h:108
void(* init)(struct recExtractCtrl *p, RecWord *w)
Definition recctrl.h:103
char match_criteria[256]
Definition recctrl.h:109
void(* tokenAdd)(RecWord *w)
Definition recctrl.h:105
zint staticrank
Definition recctrl.h:110
void(* setStoreData)(struct recExtractCtrl *p, void *buf, size_t size)
Definition recctrl.h:106
struct ZebraRecStream * stream
Definition recctrl.h:102
const Odr_oid * input_format
Definition recctrl.h:123
Z_RecordComposition * comp
Definition recctrl.h:124
struct ZebraRecStream * stream
Definition recctrl.h:119
const Odr_oid * output_format
Definition recctrl.h:134
void * rec_buf
Definition recctrl.h:135
long zint
Zebra integer.
Definition util.h:66
#define ZEBRA_FAIL
Definition util.h:81
#define ZINT_FORMAT
Definition util.h:72
zint atozint(const char *src)
Definition zint.c:55
#define ZEBRA_OK
Definition util.h:82
short ZEBRA_RES
Common return type for Zebra API.
Definition util.h:80