1 /* $Id: retrieve.c,v 1.72 2007-08-21 13:27:04 adam Exp $
2 Copyright (C) 1995-2007
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
36 #include <yaz/diagbib1.h>
37 #include <yaz/snprintf.h>
39 #include <yaz/oid_db.h>
41 #define ZEBRA_XML_HEADER_STR "<record xmlns=\"http://www.indexdata.com/zebra/\""
43 static int zebra_create_record_stream(ZebraHandle zh,
45 struct ZebraRecStream *stream)
47 RecordAttr *recordAttr = rec_init_attr(zh->reg->zei, *rec);
49 if ((*rec)->size[recInfo_storeData] > 0)
50 zebra_create_stream_mem(stream, (*rec)->info[recInfo_storeData],
51 (*rec)->size[recInfo_storeData]);
57 if (zh->path_reg && !yaz_is_abspath((*rec)->info[recInfo_filename])){
58 strcpy(full_rep, zh->path_reg);
59 strcat(full_rep, "/");
60 strcat(full_rep, (*rec)->info[recInfo_filename]);
63 strcpy(full_rep, (*rec)->info[recInfo_filename]);
65 if ((fd = open (full_rep, O_BINARY|O_RDONLY)) == -1){
66 yaz_log (YLOG_WARN|YLOG_ERRNO, "Retrieve fail; missing file: %s",
69 return YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
71 zebra_create_stream_fd(stream, fd, recordAttr->recordOffset);
78 static int parse_zebra_elem(const char *elem,
79 const char **index, size_t *index_len,
80 const char **type, size_t *type_len)
91 /* verify that '::' is in the beginning of *elem
92 and something more follows */
94 || !(elem +1) || ':' != *(elem +1)
95 || !(elem +2) || '\0' == *(elem +2))
98 /* pick out info from string after '::' */
100 cp = strchr(elem, ':');
102 if (!cp) /* index, no colon, no type */
105 *index_len = strlen(elem);
107 else if (cp[1] == '\0') /* colon, but no following type */
111 else /* index, colon and type */
114 *index_len = cp - elem;
116 *type_len = strlen(cp+1);
123 int zebra_special_sort_fetch(ZebraHandle zh, zint sysno, ODR odr,
124 const char *elemsetname,
125 const Odr_oid *input_format,
126 const Odr_oid **output_format,
127 char **rec_bufp, int *rec_lenp)
129 const char *retrieval_index;
130 size_t retrieval_index_len;
131 const char *retrieval_type;
132 size_t retrieval_type_len;
133 char retrieval_index_cstr[256];
136 /* only accept XML and SUTRS requests */
137 if (oid_oidcmp(input_format, yaz_oid_recsyn_xml)
138 && oid_oidcmp(input_format, yaz_oid_recsyn_sutrs))
140 yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s",
143 return YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
146 if (!parse_zebra_elem(elemsetname,
147 &retrieval_index, &retrieval_index_len,
148 &retrieval_type, &retrieval_type_len))
150 return YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_;
153 if (retrieval_type_len == 0)
154 return -1; /* must have a register type specified */
155 if (!retrieval_index_len ||
156 retrieval_index_len >= sizeof(retrieval_index_cstr)-1)
158 return YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_;
161 memcpy(retrieval_index_cstr, retrieval_index, retrieval_index_len);
162 retrieval_index_cstr[retrieval_index_len] = '\0';
164 ord = zebraExplain_lookup_attr_str(zh->reg->zei,
165 zinfo_index_category_sort,
167 retrieval_index_cstr);
169 return -1; /* is not a sort index */
172 char dst_buf[IT_MAX_WORD];
173 char str[IT_MAX_WORD];
176 const char *string_index = 0;
177 WRBUF wrbuf = wrbuf_alloc();
179 zebra_sort_sysno(zh->reg->sort_index, sysno);
180 zebra_sort_type(zh->reg->sort_index, ord);
181 zebra_sort_read(zh->reg->sort_index, str);
183 zebraExplain_lookup_ord(zh->reg->zei, ord, &index_type, &db, &string_index);
185 zebra_term_untrans(zh, index_type, dst_buf, str);
188 if (!oid_oidcmp(input_format, yaz_oid_recsyn_xml))
190 *output_format = yaz_oid_recsyn_xml;
191 wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
192 " sysno=\"" ZINT_FORMAT "\""
193 " set=\"zebra::index%s/\">\n",
196 wrbuf_printf(wrbuf, " <index name=\"%s\"",
198 wrbuf_printf(wrbuf, " type=\"%c\">", index_type);
199 wrbuf_xmlputs(wrbuf, dst_buf);
200 wrbuf_printf(wrbuf, "</index>\n");
201 wrbuf_printf(wrbuf, "</record>\n");
203 else if (!oid_oidcmp(input_format, yaz_oid_recsyn_sutrs))
205 *output_format = yaz_oid_recsyn_sutrs;
207 wrbuf_printf(wrbuf, "%s %c %s\n", string_index, index_type,
210 *rec_lenp = wrbuf_len(wrbuf);
211 *rec_bufp = odr_malloc(odr, *rec_lenp);
212 memcpy(*rec_bufp, wrbuf_buf(wrbuf), *rec_lenp);
213 wrbuf_destroy(wrbuf);
218 int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
220 const char *elemsetname,
221 const Odr_oid *input_format,
222 const Odr_oid **output_format,
223 char **rec_bufp, int *rec_lenp)
225 const char *retrieval_index;
226 size_t retrieval_index_len;
227 const char *retrieval_type;
228 size_t retrieval_type_len;
229 zebra_rec_keys_t keys;
232 /* set output variables before processing possible error states */
235 /* only accept XML and SUTRS requests */
236 if (oid_oidcmp(input_format, yaz_oid_recsyn_xml)
237 && oid_oidcmp(input_format, yaz_oid_recsyn_sutrs))
239 yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s",
242 return YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
245 if (!parse_zebra_elem(elemsetname,
246 &retrieval_index, &retrieval_index_len,
247 &retrieval_type, &retrieval_type_len))
248 return YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_;
250 if (retrieval_type_len != 0 && retrieval_type_len != 1)
252 return YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_;
255 if (retrieval_index_len)
257 char retrieval_index_cstr[256];
259 if (retrieval_index_len < sizeof(retrieval_index_cstr) -1)
261 memcpy(retrieval_index_cstr, retrieval_index, retrieval_index_len);
262 retrieval_index_cstr[retrieval_index_len] = '\0';
264 if (zebraExplain_lookup_attr_str(zh->reg->zei,
265 zinfo_index_category_index,
266 (retrieval_type_len == 0 ? -1 :
268 retrieval_index_cstr) == -1)
269 return YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_;
273 keys = zebra_rec_keys_open();
274 zebra_rec_keys_set_buf(keys, rec->info[recInfo_delKeys],
275 rec->size[recInfo_delKeys], 0);
277 if (!zebra_rec_keys_rewind(keys))
279 ret_code = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
285 struct it_key key_in;
286 WRBUF wrbuf = wrbuf_alloc();
288 if (!oid_oidcmp(input_format, yaz_oid_recsyn_xml))
290 *output_format = input_format;
291 wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
292 " sysno=\"" ZINT_FORMAT "\""
293 " set=\"zebra::index%s/\">\n",
296 else if (!oid_oidcmp(input_format, yaz_oid_recsyn_sutrs))
297 *output_format = input_format;
299 while (zebra_rec_keys_read(keys, &str, &slen, &key_in))
302 int ord = CAST_ZINT_TO_INT(key_in.mem[0]);
305 const char *string_index = 0;
306 size_t string_index_len;
307 char dst_buf[IT_MAX_WORD];
309 zebraExplain_lookup_ord(zh->reg->zei, ord, &index_type, &db,
311 string_index_len = strlen(string_index);
313 /* process only if index is not defined,
314 or if defined and matching */
315 if (retrieval_index == 0
316 || (string_index_len == retrieval_index_len
317 && !memcmp(string_index, retrieval_index,
320 /* process only if type is not defined, or is matching */
321 if (retrieval_type == 0
322 || (retrieval_type_len == 1
323 && retrieval_type[0] == index_type))
325 zebra_term_untrans(zh, index_type, dst_buf, str);
328 if (!oid_oidcmp(input_format, yaz_oid_recsyn_xml))
330 wrbuf_printf(wrbuf, " <index name=\"%s\"",
333 wrbuf_printf(wrbuf, " type=\"%c\"", index_type);
335 wrbuf_printf(wrbuf, " seq=\"" ZINT_FORMAT "\">",
336 key_in.mem[key_in.len -1]);
338 wrbuf_xmlputs(wrbuf, dst_buf);
339 wrbuf_printf(wrbuf, "</index>\n");
343 wrbuf_printf(wrbuf, "%s ", string_index);
345 wrbuf_printf(wrbuf, "%c", index_type);
347 for (i = 1; i < key_in.len; i++)
348 wrbuf_printf(wrbuf, " " ZINT_FORMAT,
351 /* zebra_term_untrans(zh, index_type, dst_buf, str); */
352 wrbuf_printf(wrbuf, " %s", dst_buf);
354 wrbuf_printf(wrbuf, "\n");
361 if (!oid_oidcmp(input_format, yaz_oid_recsyn_xml))
362 wrbuf_printf(wrbuf, "</record>\n");
363 *rec_lenp = wrbuf_len(wrbuf);
364 *rec_bufp = odr_malloc(odr, *rec_lenp);
365 memcpy(*rec_bufp, wrbuf_buf(wrbuf), *rec_lenp);
366 wrbuf_destroy(wrbuf);
368 zebra_rec_keys_close(keys);
373 static void retrieve_puts_attr(WRBUF wrbuf, const char *name,
378 wrbuf_printf(wrbuf, " %s=\"", name);
379 wrbuf_xmlputs(wrbuf, value);
380 wrbuf_printf(wrbuf, "\"");
384 static void retrieve_puts_attr_int(WRBUF wrbuf, const char *name,
387 wrbuf_printf(wrbuf, " %s=\"%i\"", name, value);
390 static void retrieve_puts_str(WRBUF wrbuf, const char *name,
394 wrbuf_printf(wrbuf, "%s %s\n", name, value);
397 static void retrieve_puts_int(WRBUF wrbuf, const char *name,
400 wrbuf_printf(wrbuf, "%s %i\n", name, value);
404 static void snippet_xml_record(ZebraHandle zh, WRBUF wrbuf, zebra_snippets *doc)
406 const zebra_snippet_word *doc_w;
409 wrbuf_printf(wrbuf, "%s>\n", ZEBRA_XML_HEADER_STR);
410 for (doc_w = zebra_snippets_constlist(doc); doc_w; doc_w = doc_w->next)
416 const char *string_index = 0;
418 zebraExplain_lookup_ord(zh->reg->zei, doc_w->ord,
419 &index_type, &db, &string_index);
423 wrbuf_printf(wrbuf, " <snippet name=\"%s\"", string_index);
424 wrbuf_printf(wrbuf, " type=\"%c\">", index_type);
427 wrbuf_puts(wrbuf, "<s>");
428 /* not printing leading ws */
429 if (mark_state || !doc_w->ws || doc_w->match)
430 wrbuf_xmlputs(wrbuf, doc_w->term);
432 wrbuf_puts(wrbuf, "</s>");
434 else if (mark_state == 1)
436 wrbuf_puts(wrbuf, "</snippet>\n");
438 mark_state = doc_w->mark;
442 wrbuf_puts(wrbuf, "</snippet>\n");
444 wrbuf_printf(wrbuf, "</record>");
447 int zebra_get_rec_snippets(ZebraHandle zh, zint sysno,
448 zebra_snippets *snippets)
451 Record rec = rec_get(zh->reg->records, sysno);
454 yaz_log(YLOG_WARN, "rec_get fail on sysno=" ZINT_FORMAT, sysno);
455 return_code = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
459 const char *file_type = rec->info[recInfo_fileType];
460 void *recTypeClientData;
461 RecType rt = recType_byName(zh->reg->recTypes, zh->res,
462 file_type, &recTypeClientData);
465 return_code = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
468 struct ZebraRecStream stream;
469 return_code = zebra_create_record_stream(zh, &rec, &stream);
470 if (return_code == 0)
472 extract_snippet(zh, snippets, &stream,
473 rt, recTypeClientData);
475 stream.destroy(&stream);
483 int zebra_special_snippet_fetch(ZebraHandle zh, const char *setname,
485 const char *elemsetname,
486 const Odr_oid *input_format,
487 const Odr_oid **output_format,
488 char **rec_bufp, int *rec_lenp)
490 zebra_snippets *rec_snippets = zebra_snippets_create();
491 int return_code = zebra_get_rec_snippets(zh, sysno, rec_snippets);
495 WRBUF wrbuf = wrbuf_alloc();
496 zebra_snippets *hit_snippet = zebra_snippets_create();
498 zebra_snippets_hit_vector(zh, setname, sysno, hit_snippet);
501 /* for debugging purposes */
502 yaz_log(YLOG_LOG, "---------------------------");
503 yaz_log(YLOG_LOG, "REC SNIPPET:");
504 zebra_snippets_log(rec_snippet, YLOG_LOG, 1);
505 yaz_log(YLOG_LOG, "---------------------------");
506 yaz_log(YLOG_LOG, "HIT SNIPPET:");
507 zebra_snippets_log(hit_snippet, YLOG_LOG, 1);
510 zebra_snippets_ring(rec_snippets, hit_snippet, 5, 5);
513 yaz_log(YLOG_LOG, "---------------------------");
514 yaz_log(YLOG_LOG, "RING SNIPPET:");
515 zebra_snippets_log(rec_snippets, YLOG_LOG, 1);
517 snippet_xml_record(zh, wrbuf, rec_snippets);
519 *output_format = yaz_oid_recsyn_xml;
521 if (return_code == 0)
523 *rec_lenp = wrbuf_len(wrbuf);
524 *rec_bufp = odr_strdup(odr, wrbuf_cstr(wrbuf));
526 wrbuf_destroy(wrbuf);
527 zebra_snippets_destroy(hit_snippet);
529 zebra_snippets_destroy(rec_snippets);
533 int zebra_special_fetch(ZebraHandle zh, const char *setname,
534 zint sysno, int score, ODR odr,
535 const char *elemsetname,
536 const Odr_oid *input_format,
537 const Odr_oid **output_format,
538 char **rec_bufp, int *rec_lenp)
542 /* set output variables before processing possible error states */
546 if (elemsetname && 0 == strcmp(elemsetname, "snippet"))
548 return zebra_special_snippet_fetch(zh, setname, sysno, odr,
550 input_format, output_format,
554 /* processing zebra::meta::sysno elemset without fetching binary data */
555 if (elemsetname && 0 == strcmp(elemsetname, "meta::sysno"))
558 WRBUF wrbuf = wrbuf_alloc();
559 if (!oid_oidcmp(input_format, yaz_oid_recsyn_sutrs))
561 wrbuf_printf(wrbuf, ZINT_FORMAT, sysno);
562 *output_format = input_format;
564 else if (!oid_oidcmp(input_format, yaz_oid_recsyn_xml))
566 wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
567 " sysno=\"" ZINT_FORMAT "\"/>\n",
569 *output_format = input_format;
571 *rec_lenp = wrbuf_len(wrbuf);
573 *rec_bufp = odr_strdup(odr, wrbuf_cstr(wrbuf));
575 ret = YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
576 wrbuf_destroy(wrbuf);
580 /* processing special elementsetname zebra::index:: for sort elements */
581 if (elemsetname && 0 == strncmp(elemsetname, "index", 5))
583 int ret = zebra_special_sort_fetch(zh, sysno, odr,
585 input_format, output_format,
589 /* not a sort index so we continue to get the full record */
593 /* fetching binary record up for all other display elementsets */
594 rec = rec_get(zh->reg->records, sysno);
597 yaz_log(YLOG_WARN, "rec_get fail on sysno=" ZINT_FORMAT, sysno);
598 return YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
601 /* processing special elementsetnames zebra::data */
602 if (elemsetname && 0 == strcmp(elemsetname, "data"))
604 struct ZebraRecStream stream;
605 RecordAttr *recordAttr = rec_init_attr(zh->reg->zei, rec);
606 zebra_create_record_stream(zh, &rec, &stream);
607 *output_format = input_format;
608 *rec_lenp = recordAttr->recordSize;
609 *rec_bufp = (char *) odr_malloc(odr, *rec_lenp);
610 stream.readf(&stream, *rec_bufp, *rec_lenp);
611 stream.destroy(&stream);
616 /* only accept XML and SUTRS requests from now */
617 if (oid_oidcmp(input_format, yaz_oid_recsyn_xml)
618 && oid_oidcmp(input_format, yaz_oid_recsyn_sutrs))
620 yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s",
622 return YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
626 /* processing special elementsetnames zebra::meta:: */
627 if (elemsetname && 0 == strcmp(elemsetname, "meta"))
630 WRBUF wrbuf = wrbuf_alloc();
631 RecordAttr *recordAttr = rec_init_attr(zh->reg->zei, rec);
633 if (!oid_oidcmp(input_format, yaz_oid_recsyn_xml))
635 *output_format = input_format;
637 wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
638 " sysno=\"" ZINT_FORMAT "\"", sysno);
639 retrieve_puts_attr(wrbuf, "base", rec->info[recInfo_databaseName]);
640 retrieve_puts_attr(wrbuf, "file", rec->info[recInfo_filename]);
641 retrieve_puts_attr(wrbuf, "type", rec->info[recInfo_fileType]);
643 retrieve_puts_attr_int(wrbuf, "score", score);
646 " rank=\"" ZINT_FORMAT "\""
648 " set=\"zebra::%s\"/>\n",
649 recordAttr->staticrank,
650 recordAttr->recordSize,
653 else if (!oid_oidcmp(input_format, yaz_oid_recsyn_sutrs))
655 *output_format = input_format;
656 wrbuf_printf(wrbuf, "sysno " ZINT_FORMAT "\n", sysno);
657 retrieve_puts_str(wrbuf, "base", rec->info[recInfo_databaseName]);
658 retrieve_puts_str(wrbuf, "file", rec->info[recInfo_filename]);
659 retrieve_puts_str(wrbuf, "type", rec->info[recInfo_fileType]);
661 retrieve_puts_int(wrbuf, "score", score);
664 "rank " ZINT_FORMAT "\n"
667 recordAttr->staticrank,
668 recordAttr->recordSize,
671 *rec_lenp = wrbuf_len(wrbuf);
673 *rec_bufp = odr_strdup(odr, wrbuf_cstr(wrbuf));
675 ret = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
677 wrbuf_destroy(wrbuf);
682 /* processing special elementsetnames zebra::index:: */
683 if (elemsetname && 0 == strncmp(elemsetname, "index", 5))
685 int ret = zebra_special_index_fetch(zh, sysno, odr, rec,
687 input_format, output_format,
696 return YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_;
700 int zebra_record_fetch(ZebraHandle zh, const char *setname,
701 zint sysno, int score,
702 zebra_snippets *hit_snippet, ODR odr,
703 const Odr_oid *input_format, Z_RecordComposition *comp,
704 const Odr_oid **output_format,
705 char **rec_bufp, int *rec_lenp, char **basenamep,
709 char *fname, *file_type, *basename;
710 const char *elemsetname;
711 struct ZebraRecStream stream;
712 RecordAttr *recordAttr;
718 elemsetname = yaz_get_esn(comp);
720 /* processing zebra special elementset names of form 'zebra:: */
721 if (elemsetname && 0 == strncmp(elemsetname, "zebra::", 7))
722 return zebra_special_fetch(zh, setname, sysno, score, odr,
724 input_format, output_format,
728 /* processing all other element set names */
729 rec = rec_get(zh->reg->records, sysno);
732 yaz_log(YLOG_WARN, "rec_get fail on sysno=" ZINT_FORMAT, sysno);
734 return YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
738 recordAttr = rec_init_attr(zh->reg->zei, rec);
740 file_type = rec->info[recInfo_fileType];
741 fname = rec->info[recInfo_filename];
742 basename = rec->info[recInfo_databaseName];
743 *basenamep = (char *) odr_malloc (odr, strlen(basename)+1);
744 strcpy (*basenamep, basename);
746 yaz_log(YLOG_DEBUG, "retrieve localno=" ZINT_FORMAT " score=%d",
749 return_code = zebra_create_record_stream(zh, &rec, &stream);
753 zebra_rec_keys_t reckeys = zebra_rec_keys_open();
755 struct recRetrieveCtrl retrieveCtrl;
757 retrieveCtrl.stream = &stream;
758 retrieveCtrl.fname = fname;
759 retrieveCtrl.localno = sysno;
760 retrieveCtrl.staticrank = recordAttr->staticrank;
761 retrieveCtrl.score = score;
762 retrieveCtrl.recordSize = recordAttr->recordSize;
763 retrieveCtrl.odr = odr;
764 retrieveCtrl.input_format = retrieveCtrl.output_format = input_format;
765 retrieveCtrl.comp = comp;
766 retrieveCtrl.encoding = zh->record_encoding;
767 retrieveCtrl.diagnostic = 0;
768 retrieveCtrl.addinfo = 0;
769 retrieveCtrl.dh = zh->reg->dh;
770 retrieveCtrl.res = zh->res;
771 retrieveCtrl.rec_buf = 0;
772 retrieveCtrl.rec_len = -1;
773 retrieveCtrl.hit_snippet = hit_snippet;
774 retrieveCtrl.doc_snippet = zebra_snippets_create();
776 zebra_rec_keys_set_buf(reckeys,
777 rec->info[recInfo_delKeys],
778 rec->size[recInfo_delKeys],
780 zebra_rec_keys_to_snippets(zh, reckeys, retrieveCtrl.doc_snippet);
781 zebra_rec_keys_close(reckeys);
783 if (!(rt = recType_byName(zh->reg->recTypes, zh->res,
784 file_type, &clientData)))
786 char addinfo_str[100];
788 sprintf(addinfo_str, "Could not handle record type %.40s",
791 *addinfo = odr_strdup(odr, addinfo_str);
792 return_code = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
796 (*rt->retrieve)(clientData, &retrieveCtrl);
797 return_code = retrieveCtrl.diagnostic;
799 *output_format = retrieveCtrl.output_format;
800 *rec_bufp = (char *) retrieveCtrl.rec_buf;
801 *rec_lenp = retrieveCtrl.rec_len;
802 *addinfo = retrieveCtrl.addinfo;
805 zebra_snippets_destroy(retrieveCtrl.doc_snippet);
807 stream.destroy(&stream);
817 * indent-tabs-mode: nil
819 * vim: shiftwidth=4 tabstop=8 expandtab