YAZ 5.37.0
solr.c
Go to the documentation of this file.
1/* This file is part of the YAZ toolkit.
2 * Copyright (C) Index Data
3 * See the file LICENSE for details.
4 */
9#if HAVE_CONFIG_H
10#include <config.h>
11#endif
12
13#include <stdlib.h>
14#include <assert.h>
15#include <yaz/srw.h>
16#include <yaz/matchstr.h>
17#include <yaz/yaz-iconv.h>
18#include <yaz/log.h>
19#include <yaz/facet.h>
20#include <yaz/wrbuf.h>
21#include <yaz/proto.h>
22#include <yaz/nmem_xml.h>
23
24#include "sru-p.h"
25
26#if YAZ_HAVE_XML2
27#include <libxml/parser.h>
28#include <libxml/tree.h>
29
30static void extract_text_node(xmlNodePtr node, WRBUF wrbuf)
31{
32 xmlNodePtr child;
33 for (child = node->children; child ; child = child->next)
34 if (child->type == XML_TEXT_NODE)
35 wrbuf_xmlputs(wrbuf, (const char *) child->content);
36}
37
39 xmlNodePtr ptr,
40 const char *node_name, const char *attribute_name, const char *value)
41{
42 const char *attribute_value;
43 if (strcmp((const char*) ptr->name, node_name))
44 return 0;
45 if (attribute_name)
46 {
47 attribute_value = yaz_element_attribute_value_get(ptr, node_name,
48 attribute_name);
49 if (attribute_value && !strcmp(attribute_value, value))
50 return 1;
51 }
52 else /* No attribute to check */
53 return 1;
54 return 0;
55}
56
57static void yaz_solr_decode_result_docs(ODR o, xmlNodePtr ptr,
58 Odr_int start,
60{
61 xmlNodePtr node;
62 int offset = 0;
63 int i = 0;
64
65 sr->num_records = 0;
66 for (node = ptr->children; node; node = node->next)
67 if (node->type == XML_ELEMENT_NODE)
68 sr->num_records++;
69
70 if (sr->num_records)
71 sr->records = odr_malloc(o, sizeof(*sr->records) * sr->num_records);
72
73 for (node = ptr->children; node; node = node->next)
74 {
75 if (node->type == XML_ELEMENT_NODE)
76 {
77 Z_SRW_record *record = sr->records + i;
78 xmlBufferPtr buf = xmlBufferCreate();
79 xmlNode *tmp = xmlCopyNode(node, 1);
80
81 xmlNodeDump(buf, tmp->doc, tmp, 0, 0);
82
83 xmlFreeNode(tmp);
84
85 record->recordSchema = 0;
88 record->recordPosition = odr_intdup(o, start + offset + 1);
89
90 xmlBufferFree(buf);
91
92 offset++;
93 i++;
94 }
95 }
96}
97
98static int yaz_solr_decode_result(ODR o, xmlNodePtr ptr,
100{
101 Odr_int start = 0;
102 struct _xmlAttr *attr;
103 for (attr = ptr->properties; attr; attr = attr->next)
104 if (attr->children && attr->children->type == XML_TEXT_NODE)
105 {
106 if (!strcmp((const char *) attr->name, "numFound"))
107 {
109 (const char *) attr->children->content));
110 }
111 else if (!strcmp((const char *) attr->name, "start"))
112 {
113 start = odr_atoi((const char *) attr->children->content);
114 }
115 }
116 if (sr->numberOfRecords && *sr->numberOfRecords > 0)
117 yaz_solr_decode_result_docs(o, ptr, start, sr);
118 if (sr->numberOfRecords)
119 return 0;
120 return -1;
121}
122
123static const char *get_facet_term_count(ODR o, xmlNodePtr node, Odr_int *freq)
124{
125 const char *term = yaz_element_attribute_value_get(node, "int", "name");
126 if (!term)
127 return term;
128
129 *freq = odr_atoi(nmem_text_node_cdata(node->children, odr_getmem(o)));
130 return term;
131}
132
135
136{
137 Z_AttributeList *list;
138 Z_FacetField *facet_field;
139 int num_terms = 0;
140 int index = 0;
141 xmlNodePtr node;
142 const char* name = yaz_element_attribute_value_get(ptr, "lst", "name");
143
144 if (name == 0)
145 return 0;
147 for (node = ptr->children; node; node = node->next)
148 num_terms++;
149 facet_field = facet_field_create(o, list, num_terms);
150 index = 0;
151 for (node = ptr->children; node; node = node->next)
152 {
153 Odr_int count = 0;
154 const char *term = get_facet_term_count(o, node, &count);
155 if (term)
156 {
157 facet_field_term_set(o, facet_field,
158 facet_term_create_cstr(o, term, count), index);
159 index++;
160 }
161 }
162 facet_field->num_terms = index;
163 return facet_field;
164}
165
166static int yaz_solr_decode_facet_counts(ODR o, xmlNodePtr root,
168{
169 xmlNodePtr ptr;
170 for (ptr = root->children; ptr; ptr = ptr->next)
171 {
172 if (match_xml_node_attribute(ptr, "lst", "name", "facet_fields"))
173 {
174 xmlNodePtr node;
175 Z_FacetList *facet_list;
176 int num_facets = 0;
177 for (node = ptr->children; node; node= node->next)
178 num_facets++;
179 facet_list = facet_list_create(o, num_facets);
180 num_facets = 0;
181 for (node = ptr->children; node; node = node->next)
182 {
183 Z_FacetField *ff = yaz_solr_decode_facet_field(o, node, sr);
184 if (ff)
185 {
186 facet_list_field_set(o, facet_list, ff, num_facets);
187 num_facets++;
188 }
189 }
190 sr->facetList = facet_list;
191 sr->facetList->num = num_facets;
192 break;
193 }
194 }
195 return 0;
196}
197
198static void yaz_solr_decode_suggestion_values(xmlNodePtr listPptr, WRBUF wrbuf)
199{
200 xmlNodePtr node;
201 for (node = listPptr; node; node = node->next)
202 if (node->type == XML_ELEMENT_NODE
203 && !strcmp((const char*) node->name, "lst"))
204 {
205 xmlNodePtr child;
206 for (child = node->children; child; child= child->next)
207 {
208 if (match_xml_node_attribute(child, "str", "name", "word"))
209 {
210 wrbuf_puts(wrbuf, "<suggestion>");
211 extract_text_node(child, wrbuf);
212 wrbuf_puts(wrbuf, "</suggestion>\n");
213 }
214 }
215 }
216}
217
218static void yaz_solr_decode_suggestion_lst(xmlNodePtr lstPtr, WRBUF wrbuf)
219{
220 xmlNodePtr node;
221 for (node = lstPtr; node; node = node->next)
222 if (match_xml_node_attribute(node, "arr", "name", "suggestion"))
224}
225
226static void yaz_solr_decode_misspelled(xmlNodePtr lstPtr, WRBUF wrbuf)
227{
228 xmlNodePtr node;
229 for (node = lstPtr; node; node= node->next)
230 {
231 if (node->type == XML_ELEMENT_NODE)
232 {
233 const char *misspelled =
234 yaz_element_attribute_value_get(node, "lst", "name");
235 if (misspelled)
236 {
237 wrbuf_printf(wrbuf, "<misspelled term=\"");
238 wrbuf_xmlputs(wrbuf, misspelled);
239 wrbuf_printf(wrbuf, "\">\n");
240 yaz_solr_decode_suggestion_lst(node->children, wrbuf);
241 wrbuf_puts(wrbuf, "</misspelled>\n");
242 }
243 }
244 }
245}
246
247static int yaz_solr_decode_spellcheck(ODR o, xmlNodePtr spellcheckPtr,
249{
250 xmlNodePtr ptr;
252 for (ptr = spellcheckPtr->children; ptr; ptr = ptr->next)
253 if (match_xml_node_attribute(ptr, "lst", "name", "suggestions"))
254 yaz_solr_decode_misspelled(ptr->children, wrbuf);
257 return 0;
258}
259
260static int yaz_solr_decode_scan_result(ODR o, xmlNodePtr ptr,
262{
263 xmlNodePtr node;
264 char *pos;
265 int i = 0;
266
267 /* find the actual list */
268 for (node = ptr->children; node; node = node->next)
269 if (node->type == XML_ELEMENT_NODE)
270 {
271 ptr = node;
272 break;
273 }
274
275 scr->num_terms = 0;
276 for (node = ptr->children; node; node = node->next)
277 if (node->type == XML_ELEMENT_NODE &&
278 !strcmp((const char *) node->name, "int"))
279 scr->num_terms++;
280
281 if (scr->num_terms)
282 scr->terms = odr_malloc(o, sizeof(*scr->terms) * scr->num_terms);
283
284 for (node = ptr->children; node; node = node->next)
285 {
286 if (node->type == XML_ELEMENT_NODE &&
287 !strcmp((const char *) node->name, "int"))
288 {
289 Z_SRW_scanTerm *term = scr->terms + i;
290
291 Odr_int count = 0;
292 const char *val = get_facet_term_count(o, node, &count);
293
294 term->numberOfRecords = odr_intdup(o, count);
295
296 /* if val contains a ^ then it is probably term<^>display term so separate them.
297 * This is due to SOLR not being able to encode them into 2 separate attributes.
298 */
299 pos = strchr(val, '^');
300 if (pos != NULL)
301 {
302 term->displayTerm = odr_strdup(o, pos + 1);
303 *pos = '\0';
304 term->value = odr_strdup(o, val);
305 *pos = '^';
306 }
307 else
308 {
309 term->value = odr_strdup(o, val);
310 term->displayTerm = NULL;
311 }
312 term->whereInList = NULL;
313 i++;
314 }
315 }
316
317 if (scr->num_terms)
318 return 0;
319 return -1;
320}
321
322static int yaz_solr_decode_error(ODR o, xmlNode *ptr,
324{
325 for (ptr = ptr->children; ptr; ptr = ptr->next)
326 if (ptr->type == XML_ELEMENT_NODE &&
327 match_xml_node_attribute(ptr, "str", "name", "msg"))
328 {
329 char *msg = nmem_text_node_cdata(ptr->children, odr_getmem(o));
332 }
333 return 0;
334}
335
336#endif
337
339{
340 int ret = -1;
341 Z_SRW_PDU *pdu = 0;
342#if YAZ_HAVE_XML2
343 const char *content_buf = hres->content_buf;
344 int content_len = hres->content_len;
345 xmlDocPtr doc = xmlParseMemory(content_buf, content_len);
346
347 if (doc)
348 {
350 Z_SRW_scanResponse *scr = NULL;
351 xmlNodePtr ptr;
352 xmlNodePtr root = xmlDocGetRootElement(doc);
353 if (root && !strcmp((const char *) root->name, "response"))
354 {
355 for (ptr = root->children; ptr; ptr = ptr->next)
356 {
357 if (!pdu && ptr->type == XML_ELEMENT_NODE &&
358 match_xml_node_attribute(ptr, "lst", "name", "error"))
359 {
361 sr = pdu->u.response;
362 ret = yaz_solr_decode_error(o, ptr, sr);
363 }
364 if (ptr->type == XML_ELEMENT_NODE &&
365 !strcmp((const char *) ptr->name, "result"))
366 {
368 sr = pdu->u.response;
369 ret = yaz_solr_decode_result(o, ptr, sr);
370 }
371 if (ptr->type == XML_ELEMENT_NODE &&
372 match_xml_node_attribute(ptr, "lst", "name", "terms"))
373 {
375 scr = pdu->u.scan_response;
376 ret = yaz_solr_decode_scan_result(o, ptr, scr);
377 }
378 /* The check on hits is a work-around to avoid garbled
379 facets on zero results from the SOLR server.
380 The work-around works because the results is before
381 the facets in the xml.
382 */
383 if (sr && sr->numberOfRecords)
384 {
385 if (*sr->numberOfRecords > 0 &&
386 match_xml_node_attribute(ptr, "lst", "name",
387 "facet_counts"))
388 ret = yaz_solr_decode_facet_counts(o, ptr, sr);
389 if (*sr->numberOfRecords == 0 &&
390 match_xml_node_attribute(ptr, "lst", "name",
391 "spellcheck"))
392 ret = yaz_solr_decode_spellcheck(o, ptr, sr);
393 }
394 }
395 }
396 xmlFreeDoc(doc);
397 }
398#endif
399 *pdup = pdu;
400 return ret;
401}
402
404 ODR encode, char **name, char **value, int *i,
405 Z_FacetField *facet_field)
406{
407 Z_AttributeList *attribute_list = facet_field->attributes;
408 struct yaz_facet_attr attr_values;
409 yaz_facet_attr_init(&attr_values);
410 yaz_facet_attr_get_z_attributes(attribute_list, &attr_values);
411
412 if (attr_values.errcode)
413 return -1;
414 if (attr_values.useattr)
415 {
417 yaz_add_name_value_str(encode, name, value, i,
418 "facet.field",
419 odr_strdup(encode, attr_values.useattr));
420
421 if (attr_values.limit > 0)
422 {
423 Odr_int v = attr_values.limit;
425 wrbuf_printf(wrbuf, "f.%s.facet.limit", attr_values.useattr);
426 yaz_add_name_value_int(encode, name, value, i,
427 odr_strdup(encode, wrbuf_cstr(wrbuf)),
428 &v);
429 }
430 if (attr_values.start > 1)
431 {
432 Odr_int v = attr_values.start - 1;
434 wrbuf_printf(wrbuf, "f.%s.facet.offset", attr_values.useattr);
435 yaz_add_name_value_int(encode, name, value, i,
436 odr_strdup(encode, wrbuf_cstr(wrbuf)),
437 &v);
438 }
439 if (attr_values.sortorder == 1)
440 {
442 wrbuf_printf(wrbuf, "f.%s.facet.sort", attr_values.useattr);
443 yaz_add_name_value_str(encode, name, value, i,
444 odr_strdup(encode, wrbuf_cstr(wrbuf)),
445 "index");
446 }
448 }
449 else
450 {
451 if (attr_values.limit > 0)
452 {
453 Odr_int v = attr_values.limit;
454 yaz_add_name_value_int(encode, name, value, i, "facet.limit", &v);
455 }
456 if (attr_values.start > 1)
457 {
458 Odr_int v = attr_values.start - 1;
459 yaz_add_name_value_int(encode, name, value, i, "facet.offset", &v);
460 }
461 if (attr_values.sortorder == 1)
462 {
463 yaz_add_name_value_str(encode, name, value, i, "facet.sort",
464 "index");
465 }
466 }
467 return 0;
468}
469
471 ODR encode, char **name, char **value,
472 int *i, Z_FacetList *facet_list)
473{
474 int index;
475 for (index = 0; index < facet_list->num; index++)
476 {
477 int r = yaz_solr_encode_facet_field(encode, name, value, i,
478 facet_list->elements[index]);
479 if (r)
480 return -1;
481
482 }
483 return 0;
484}
485
487 ODR encode, const char *charset)
488{
489 const char *solr_op = 0;
490 char **name, **value;
491 char *uri_args;
492 char *path;
493 char *q;
494 char *cp;
495 int i = 0;
496 int defType_set = 0;
497 int no_parms = 20; /* safe upper limit of args without extra_args */
498 Z_SRW_extra_arg *ea;
499
500 if (srw_pdu->which == Z_SRW_searchRetrieve_request)
501 { /* to make room for facets in yaz_solr_encode_facet_list later */
503 if (request->facetList)
504 no_parms += request->facetList->num;
505 }
506 for (ea = srw_pdu->extra_args; ea; ea = ea->next)
507 no_parms++;
508 name = (char **) odr_malloc(encode, sizeof(*name) * no_parms);
509 value = (char **) odr_malloc(encode, sizeof(*value) * no_parms);
510
511 for (ea = srw_pdu->extra_args; ea; ea = ea->next)
512 {
513 name[i] = ea->name;
514 if (!strcmp(ea->name, "defType"))
515 defType_set = 1;
516 value[i] = ea->value;
517 i++;
518 }
519
521 srw_pdu->username, srw_pdu->password);
522 if (srw_pdu->which == Z_SRW_searchRetrieve_request)
523 {
525 solr_op = "select";
526 if (!srw_pdu->u.request->query)
527 return -1;
528 if (!defType_set)
529 yaz_add_name_value_str(encode, name, value, &i, "defType",
530 "lucene");
531 yaz_add_name_value_str(encode, name, value, &i, "q", request->query);
532 if (srw_pdu->u.request->startRecord)
533 {
534 Odr_int start = *request->startRecord - 1;
535 yaz_add_name_value_int(encode, name, value, &i,
536 "start", &start);
537 }
538 yaz_add_name_value_int(encode, name, value, &i,
539 "rows", request->maximumRecords);
540 yaz_add_name_value_str(encode, name, value, &i,
541 "fl", request->recordSchema);
542
543 switch(srw_pdu->u.request->sort_type)
544 {
546 break;
548 yaz_add_name_value_str(encode, name, value, &i, "sort",
549 srw_pdu->u.request->sort.sortKeys);
550 break;
551 }
552 if (request->facetList)
553 {
554 Z_FacetList *facet_list = request->facetList;
555 yaz_add_name_value_str(encode, name, value, &i, "facet", "true");
556 yaz_add_name_value_str(encode, name, value, &i, "facet.mincount", "1");
557 if (yaz_solr_encode_facet_list(encode, name, value, &i, facet_list))
558 return -1;
559 }
560 }
561 else if (srw_pdu->which == Z_SRW_scan_request)
562 {
564 solr_op = "terms";
565 if (!srw_pdu->u.scan_request->scanClause)
566 return -1;
567 if (!strcmp(srw_pdu->u.scan_request->queryType, "pqf"))
568 {
569 yaz_add_name_value_str(encode, name, value, &i,
570 "terms.fl", request->scanClause);
571 yaz_add_name_value_str(encode, name, value, &i,
572 "terms.lower", request->scanClause);
573 }
574 else if (!strcmp(srw_pdu->u.scan_request->queryType, "cql"))
575 {
576 q = request->scanClause;
577 cp = strchr(q, ':');
578 if (cp != NULL)
579 {
580 yaz_add_name_value_str(encode, name, value, &i,
581 "terms.lower", odr_strdup(encode, cp + 1));
582 *cp = '\0';
583 yaz_add_name_value_str(encode, name, value, &i,
584 "terms.fl", odr_strdup(encode, q));
585 *cp = ':';
586 }
587 else
588 yaz_add_name_value_str(encode, name, value, &i,
589 "terms.lower", odr_strdup(encode, q));
590 }
591 else
592 return -1;
593 yaz_add_name_value_str(encode, name, value, &i,
594 "terms.sort", "index");
595 yaz_add_name_value_int(encode, name, value, &i,
596 "terms.limit", request->maximumTerms);
597 }
598 else
599 return -1;
600
601 name[i++] = 0;
602
603 yaz_array_to_uri(&uri_args, encode, name, value);
604
605 hreq->method = "GET";
606
607 path = (char *)
608 odr_malloc(encode, strlen(hreq->path) +
609 strlen(uri_args) + strlen(solr_op) + 5);
610
611 cp = strchr(hreq->path, '#');
612 if (cp)
613 *cp = '\0';
614 strcpy(path, hreq->path);
615 cp = strchr(path, '?');
616 if (cp && strcmp(solr_op, "terms"))
617 { /* complete path with requestHandler */
618 int last = path[strlen(path)-1];
619 if (last != '?' && last != '&')
620 strcat(path, "&");
621 }
622 else
623 {
624 /* add requestHandler ourselves */
625 cp = strrchr(path, '/');
626 if (cp)
627 {
628 if (!strcmp(cp, "/select") || !strcmp(cp, "/"))
629 *cp = '\0';
630 }
631 strcat(path, "/");
632 strcat(path, solr_op);
633 strcat(path, "?");
634 }
635 strcat(path, uri_args);
636 hreq->path = path;
637 return 0;
638}
639
640
641/*
642 * Local variables:
643 * c-basic-offset: 4
644 * c-file-style: "Stroustrup"
645 * indent-tabs-mode: nil
646 * End:
647 * vim: shiftwidth=4 tabstop=8 expandtab
648 */
649
#define YAZ_SRW_UNSUPP_PARAMETER_VALUE
Definition diagsrw.h:15
Z_FacetList * facet_list_create(ODR odr, int num_facets)
Definition facet.c:216
Z_FacetTerm * facet_term_create_cstr(ODR odr, const char *cstr, Odr_int freq)
Definition facet.c:190
void facet_field_term_set(ODR odr, Z_FacetField *field, Z_FacetTerm *facet_term, int index)
Definition facet.c:209
void yaz_facet_attr_init(struct yaz_facet_attr *attr_values)
Definition facet.c:69
void facet_list_field_set(ODR odr, Z_FacetList *list, Z_FacetField *field, int index)
Definition facet.c:225
void yaz_facet_attr_get_z_attributes(const Z_AttributeList *attributes, struct yaz_facet_attr *av)
Definition facet.c:148
Z_FacetField * facet_field_create(ODR odr, Z_AttributeList *attributes, int num_terms)
Definition facet.c:199
Header for the facet utilities.
void z_HTTP_header_add_basic_auth(ODR o, Z_HTTP_Header **hp, const char *username, const char *password)
Definition http.c:168
char * name
Definition initopt.c:18
Logging utility.
Header for YAZ iconv interface.
char * nmem_from_xml_buffer(NMEM nmem, const xmlBufferPtr buf, int *ret_len)
copies xmlBuffer data to NMEM
Definition nmem_xml.c:36
char * nmem_text_node_cdata(const xmlNode *ptr_cdata, NMEM nmem)
copies TEXT Libxml2 node data to NMEM
Definition nmem_xml.c:19
Header for Nibble Memory functions + Libxml2 specific stuff.
#define odr_getmem(o)
Definition odr.h:216
struct odr * ODR
Definition odr.h:121
nmem_int_t Odr_int
Definition odr.h:47
Odr_int * odr_intdup(ODR o, Odr_int v)
Definition odr_mem.c:51
void * odr_malloc(ODR o, size_t size)
Definition odr_mem.c:31
char * odr_strdup(ODR o, const char *str)
Definition odr_mem.c:36
Odr_int odr_atoi(const char *s)
Definition odr_mem.c:146
Z_AttributeList * zget_AttributeList_use_string(ODR o, const char *name)
creates AttributeList with type=1(use) and string value
Definition pquery.c:310
Header for Z39.50 Protocol.
static void extract_text_node(xmlNodePtr node, WRBUF wrbuf)
Definition solr.c:30
static int yaz_solr_encode_facet_field(ODR encode, char **name, char **value, int *i, Z_FacetField *facet_field)
Definition solr.c:403
static void yaz_solr_decode_result_docs(ODR o, xmlNodePtr ptr, Odr_int start, Z_SRW_searchRetrieveResponse *sr)
Definition solr.c:57
static void yaz_solr_decode_suggestion_lst(xmlNodePtr lstPtr, WRBUF wrbuf)
Definition solr.c:218
static const char * get_facet_term_count(ODR o, xmlNodePtr node, Odr_int *freq)
Definition solr.c:123
int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, ODR encode, const char *charset)
encode SOLR request (HTTP)
Definition solr.c:486
static int match_xml_node_attribute(xmlNodePtr ptr, const char *node_name, const char *attribute_name, const char *value)
Definition solr.c:38
static void yaz_solr_decode_suggestion_values(xmlNodePtr listPptr, WRBUF wrbuf)
Definition solr.c:198
static int yaz_solr_decode_spellcheck(ODR o, xmlNodePtr spellcheckPtr, Z_SRW_searchRetrieveResponse *sr)
Definition solr.c:247
static int yaz_solr_decode_facet_counts(ODR o, xmlNodePtr root, Z_SRW_searchRetrieveResponse *sr)
Definition solr.c:166
static int yaz_solr_encode_facet_list(ODR encode, char **name, char **value, int *i, Z_FacetList *facet_list)
Definition solr.c:470
static int yaz_solr_decode_scan_result(ODR o, xmlNodePtr ptr, Z_SRW_scanResponse *scr)
Definition solr.c:260
int yaz_solr_decode_response(ODR o, Z_HTTP_Response *hres, Z_SRW_PDU **pdup)
decode SOLR response (HTTP)
Definition solr.c:338
static void yaz_solr_decode_misspelled(xmlNodePtr lstPtr, WRBUF wrbuf)
Definition solr.c:226
static int yaz_solr_decode_result(ODR o, xmlNodePtr ptr, Z_SRW_searchRetrieveResponse *sr)
Definition solr.c:98
Z_FacetField * yaz_solr_decode_facet_field(ODR o, xmlNodePtr ptr, Z_SRW_searchRetrieveResponse *sr)
Definition solr.c:133
static int yaz_solr_decode_error(ODR o, xmlNode *ptr, Z_SRW_searchRetrieveResponse *sr)
Definition solr.c:322
SRU private header.
void yaz_add_name_value_int(ODR o, char **name, char **value, int *i, char *a_name, Odr_int *val)
Definition srwutil.c:928
const char * yaz_element_attribute_value_get(xmlNodePtr ptr, const char *node_name, const char *attribute_name)
Definition srwutil.c:72
void yaz_add_name_value_str(ODR o, char **name, char **value, int *i, char *a_name, char *val)
Definition srwutil.c:939
Header for SRW/SRU.
#define Z_SRW_recordPacking_XML
Definition srw.h:55
#define Z_SRW_searchRetrieve_response
Definition srw.h:192
#define Z_SRW_scan_request
Definition srw.h:195
#define Z_SRW_sort_type_none
Definition srw.h:74
#define Z_SRW_sort_type_sort
Definition srw.h:75
#define Z_SRW_scan_response
Definition srw.h:196
#define Z_SRW_searchRetrieve_request
Definition srw.h:191
void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d, int *num, int code, const char *addinfo)
Definition srwutil.c:184
Z_SRW_PDU * yaz_srw_get(ODR o, int which)
Definition srwutil.c:756
Z_AttributeList * attributes
Definition z-facet-1.h:36
Z_FacetField ** elements
Definition z-facet-1.h:32
Z_HTTP_Header * headers
Definition zgdu.h:52
char * path
Definition zgdu.h:51
char * method
Definition zgdu.h:49
char * content_buf
Definition zgdu.h:61
int content_len
Definition zgdu.h:62
union Z_SRW_PDU::@153265143164032275136020372035363167301151223027 u
Z_SRW_scanRequest * scan_request
Definition srw.h:207
Z_SRW_searchRetrieveResponse * response
Definition srw.h:204
Z_SRW_extra_arg * extra_args
Definition srw.h:219
Z_SRW_scanResponse * scan_response
Definition srw.h:208
Z_SRW_searchRetrieveRequest * request
Definition srw.h:203
char * password
Definition srw.h:214
int which
Definition srw.h:201
char * username
Definition srw.h:213
char * value
Definition srw.h:174
Z_SRW_extra_arg * next
Definition srw.h:175
char * name
Definition srw.h:173
char * recordData_buf
Definition srw.h:58
int recordPacking
Definition srw.h:53
char * recordSchema
Definition srw.h:51
int recordData_len
Definition srw.h:59
Odr_int * recordPosition
Definition srw.h:60
char * queryType
Definition srw.h:130
char * scanClause
Definition srw.h:131
Z_SRW_scanTerm * terms
Definition srw.h:146
char * displayTerm
Definition srw.h:141
char * whereInList
Definition srw.h:142
Odr_int * numberOfRecords
Definition srw.h:140
char * value
Definition srw.h:139
union Z_SRW_searchRetrieveRequest::@240121103265220276224106134266143351075177324020 sort
Odr_int * startRecord
Definition srw.h:83
Z_SRW_record * records
Definition srw.h:103
Odr_int * numberOfRecords
Definition srw.h:98
Z_SRW_diagnostic * diagnostics
Definition srw.h:106
Z_FacetList * facetList
Definition srw.h:111
string buffer
Definition wrbuf.h:43
int sortorder
Definition facet.h:60
const char * useattr
Definition facet.h:56
int errcode
Definition facet.h:54
void yaz_array_to_uri(char **path, ODR o, char **name, char **value)
Definition uri.c:99
void wrbuf_destroy(WRBUF b)
destroy WRBUF and its buffer
Definition wrbuf.c:38
const char * wrbuf_cstr(WRBUF b)
returns WRBUF content as C-string
Definition wrbuf.c:299
void wrbuf_rewind(WRBUF b)
empty WRBUF content (length of buffer set to 0)
Definition wrbuf.c:47
WRBUF wrbuf_alloc(void)
construct WRBUF
Definition wrbuf.c:25
void wrbuf_printf(WRBUF b, const char *fmt,...)
writes printf result to WRBUF
Definition wrbuf.c:189
void wrbuf_xmlputs(WRBUF b, const char *cp)
writes C-String to WRBUF and XML encode (as CDATA)
Definition wrbuf.c:138
void wrbuf_puts(WRBUF b, const char *buf)
appends C-string to WRBUF
Definition wrbuf.c:89
Header for WRBUF (growing buffer).
struct wrbuf * WRBUF
Header for YAZ iconv interface.