YAZ 5.38.1
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;
146 list = zget_AttributeList_use_string(o, name);
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 const 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)
301 {
302 term->displayTerm = odr_strdup(o, pos + 1);
303 term->value = odr_strdupn(o, val, pos - val);
304 }
305 else
306 {
307 term->value = odr_strdup(o, val);
308 term->displayTerm = 0;
309 }
310 term->whereInList = 0;
311 i++;
312 }
313 }
314
315 if (scr->num_terms)
316 return 0;
317 return -1;
318}
319
320static int yaz_solr_decode_error(ODR o, xmlNode *ptr,
322{
323 for (ptr = ptr->children; ptr; ptr = ptr->next)
324 if (ptr->type == XML_ELEMENT_NODE &&
325 match_xml_node_attribute(ptr, "str", "name", "msg"))
326 {
327 char *msg = nmem_text_node_cdata(ptr->children, odr_getmem(o));
330 }
331 return 0;
332}
333
334#endif
335
337{
338 int ret = -1;
339 Z_SRW_PDU *pdu = 0;
340#if YAZ_HAVE_XML2
341 const char *content_buf = hres->content_buf;
342 int content_len = hres->content_len;
343 xmlDocPtr doc = xmlParseMemory(content_buf, content_len);
344
345 if (doc)
346 {
348 Z_SRW_scanResponse *scr = NULL;
349 xmlNodePtr ptr;
350 xmlNodePtr root = xmlDocGetRootElement(doc);
351 if (root && !strcmp((const char *) root->name, "response"))
352 {
353 for (ptr = root->children; ptr; ptr = ptr->next)
354 {
355 if (!pdu && ptr->type == XML_ELEMENT_NODE &&
356 match_xml_node_attribute(ptr, "lst", "name", "error"))
357 {
359 sr = pdu->u.response;
360 ret = yaz_solr_decode_error(o, ptr, sr);
361 }
362 if (ptr->type == XML_ELEMENT_NODE &&
363 !strcmp((const char *) ptr->name, "result"))
364 {
366 sr = pdu->u.response;
367 ret = yaz_solr_decode_result(o, ptr, sr);
368 }
369 if (ptr->type == XML_ELEMENT_NODE &&
370 match_xml_node_attribute(ptr, "lst", "name", "terms"))
371 {
373 scr = pdu->u.scan_response;
374 ret = yaz_solr_decode_scan_result(o, ptr, scr);
375 }
376 /* The check on hits is a work-around to avoid garbled
377 facets on zero results from the SOLR server.
378 The work-around works because the results is before
379 the facets in the xml.
380 */
381 if (sr && sr->numberOfRecords)
382 {
383 if (*sr->numberOfRecords > 0 &&
384 match_xml_node_attribute(ptr, "lst", "name",
385 "facet_counts"))
386 ret = yaz_solr_decode_facet_counts(o, ptr, sr);
387 if (*sr->numberOfRecords == 0 &&
388 match_xml_node_attribute(ptr, "lst", "name",
389 "spellcheck"))
390 ret = yaz_solr_decode_spellcheck(o, ptr, sr);
391 }
392 }
393 }
394 xmlFreeDoc(doc);
395 }
396#endif
397 *pdup = pdu;
398 return ret;
399}
400
402 ODR encode, char **name, char **value, int *i,
403 Z_FacetField *facet_field)
404{
405 Z_AttributeList *attribute_list = facet_field->attributes;
406 struct yaz_facet_attr attr_values;
407 yaz_facet_attr_init(&attr_values);
408 yaz_facet_attr_get_z_attributes(attribute_list, &attr_values);
409
410 if (attr_values.errcode)
411 return -1;
412 if (attr_values.useattr)
413 {
415 yaz_add_name_value_str(encode, name, value, i,
416 "facet.field",
417 odr_strdup(encode, attr_values.useattr));
418
419 if (attr_values.limit > 0)
420 {
421 Odr_int v = attr_values.limit;
423 wrbuf_printf(wrbuf, "f.%s.facet.limit", attr_values.useattr);
424 yaz_add_name_value_int(encode, name, value, i,
425 odr_strdup(encode, wrbuf_cstr(wrbuf)),
426 &v);
427 }
428 if (attr_values.start > 1)
429 {
430 Odr_int v = attr_values.start - 1;
432 wrbuf_printf(wrbuf, "f.%s.facet.offset", attr_values.useattr);
433 yaz_add_name_value_int(encode, name, value, i,
434 odr_strdup(encode, wrbuf_cstr(wrbuf)),
435 &v);
436 }
437 if (attr_values.sortorder == 1)
438 {
440 wrbuf_printf(wrbuf, "f.%s.facet.sort", attr_values.useattr);
441 yaz_add_name_value_str(encode, name, value, i,
442 odr_strdup(encode, wrbuf_cstr(wrbuf)),
443 "index");
444 }
446 }
447 else
448 {
449 if (attr_values.limit > 0)
450 {
451 Odr_int v = attr_values.limit;
452 yaz_add_name_value_int(encode, name, value, i, "facet.limit", &v);
453 }
454 if (attr_values.start > 1)
455 {
456 Odr_int v = attr_values.start - 1;
457 yaz_add_name_value_int(encode, name, value, i, "facet.offset", &v);
458 }
459 if (attr_values.sortorder == 1)
460 {
461 yaz_add_name_value_str(encode, name, value, i, "facet.sort",
462 "index");
463 }
464 }
465 return 0;
466}
467
469 ODR encode, char **name, char **value,
470 int *i, Z_FacetList *facet_list)
471{
472 int index;
473 for (index = 0; index < facet_list->num; index++)
474 {
475 int r = yaz_solr_encode_facet_field(encode, name, value, i,
476 facet_list->elements[index]);
477 if (r)
478 return -1;
479
480 }
481 return 0;
482}
483
485 ODR encode, const char *charset)
486{
487 const char *solr_op = 0;
488 char **name, **value;
489 char *uri_args;
490 char *path;
491 char *q;
492 char *cp;
493 int i = 0;
494 int defType_set = 0;
495 int no_parms = 20; /* safe upper limit of args without extra_args */
496 Z_SRW_extra_arg *ea;
497
498 if (srw_pdu->which == Z_SRW_searchRetrieve_request)
499 { /* to make room for facets in yaz_solr_encode_facet_list later */
500 Z_SRW_searchRetrieveRequest *request = srw_pdu->u.request;
501 if (request->facetList)
502 no_parms += request->facetList->num;
503 }
504 for (ea = srw_pdu->extra_args; ea; ea = ea->next)
505 no_parms++;
506 name = (char **) odr_malloc(encode, sizeof(*name) * no_parms);
507 value = (char **) odr_malloc(encode, sizeof(*value) * no_parms);
508
509 for (ea = srw_pdu->extra_args; ea; ea = ea->next)
510 {
511 name[i] = ea->name;
512 if (!strcmp(ea->name, "defType"))
513 defType_set = 1;
514 value[i] = ea->value;
515 i++;
516 }
517
519 srw_pdu->username, srw_pdu->password);
520 if (srw_pdu->which == Z_SRW_searchRetrieve_request)
521 {
522 Z_SRW_searchRetrieveRequest *request = srw_pdu->u.request;
523 solr_op = "select";
524 if (!srw_pdu->u.request->query)
525 return -1;
526 if (!defType_set)
527 yaz_add_name_value_str(encode, name, value, &i, "defType",
528 "lucene");
529 yaz_add_name_value_str(encode, name, value, &i, "q", request->query);
530 if (srw_pdu->u.request->startRecord)
531 {
532 Odr_int start = *request->startRecord - 1;
533 yaz_add_name_value_int(encode, name, value, &i,
534 "start", &start);
535 }
536 yaz_add_name_value_int(encode, name, value, &i,
537 "rows", request->maximumRecords);
538 yaz_add_name_value_str(encode, name, value, &i,
539 "fl", request->recordSchema);
540
541 switch(srw_pdu->u.request->sort_type)
542 {
544 break;
546 yaz_add_name_value_str(encode, name, value, &i, "sort",
547 srw_pdu->u.request->sort.sortKeys);
548 break;
549 }
550 if (request->facetList)
551 {
552 Z_FacetList *facet_list = request->facetList;
553 yaz_add_name_value_str(encode, name, value, &i, "facet", "true");
554 yaz_add_name_value_str(encode, name, value, &i, "facet.mincount", "1");
555 if (yaz_solr_encode_facet_list(encode, name, value, &i, facet_list))
556 return -1;
557 }
558 }
559 else if (srw_pdu->which == Z_SRW_scan_request)
560 {
561 Z_SRW_scanRequest *request = srw_pdu->u.scan_request;
562 solr_op = "terms";
563 if (!srw_pdu->u.scan_request->scanClause)
564 return -1;
565 if (!strcmp(srw_pdu->u.scan_request->queryType, "pqf"))
566 {
567 yaz_add_name_value_str(encode, name, value, &i,
568 "terms.fl", request->scanClause);
569 yaz_add_name_value_str(encode, name, value, &i,
570 "terms.lower", request->scanClause);
571 }
572 else if (!strcmp(srw_pdu->u.scan_request->queryType, "cql"))
573 {
574 q = request->scanClause;
575 cp = strchr(q, ':');
576 if (cp != NULL)
577 {
578 yaz_add_name_value_str(encode, name, value, &i,
579 "terms.lower", odr_strdup(encode, cp + 1));
580 *cp = '\0';
581 yaz_add_name_value_str(encode, name, value, &i,
582 "terms.fl", odr_strdup(encode, q));
583 *cp = ':';
584 }
585 else
586 yaz_add_name_value_str(encode, name, value, &i,
587 "terms.lower", odr_strdup(encode, q));
588 }
589 else
590 return -1;
591 yaz_add_name_value_str(encode, name, value, &i,
592 "terms.sort", "index");
593 yaz_add_name_value_int(encode, name, value, &i,
594 "terms.limit", request->maximumTerms);
595 }
596 else
597 return -1;
598
599 name[i++] = 0;
600
601 yaz_array_to_uri(&uri_args, encode, name, value);
602
603 hreq->method = "GET";
604
605 path = (char *)
606 odr_malloc(encode, strlen(hreq->path) +
607 strlen(uri_args) + strlen(solr_op) + 5);
608
609 cp = strchr(hreq->path, '#');
610 if (cp)
611 *cp = '\0';
612 strcpy(path, hreq->path);
613 cp = strchr(path, '?');
614 if (cp && strcmp(solr_op, "terms"))
615 { /* complete path with requestHandler */
616 int last = path[strlen(path)-1];
617 if (last != '?' && last != '&')
618 strcat(path, "&");
619 }
620 else
621 {
622 /* add requestHandler ourselves */
623 cp = strrchr(path, '/');
624 if (cp)
625 {
626 if (!strcmp(cp, "/select") || !strcmp(cp, "/"))
627 *cp = '\0';
628 }
629 strcat(path, "/");
630 strcat(path, solr_op);
631 strcat(path, "?");
632 }
633 strcat(path, uri_args);
634 hreq->path = path;
635 return 0;
636}
637
638
639/*
640 * Local variables:
641 * c-basic-offset: 4
642 * c-file-style: "Stroustrup"
643 * indent-tabs-mode: nil
644 * End:
645 * vim: shiftwidth=4 tabstop=8 expandtab
646 */
647
#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:135
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_strdupn(ODR o, const char *str, size_t n)
Definition odr_mem.c:46
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:401
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:484
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:468
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:336
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:320
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_extra_arg * extra_args
Definition srw.h:219
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
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
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.