YAZ
5.34.0
|
Implements Solr decoding/encoding. More...
#include <stdlib.h>
#include <assert.h>
#include <yaz/srw.h>
#include <yaz/matchstr.h>
#include <yaz/yaz-iconv.h>
#include <yaz/log.h>
#include <yaz/facet.h>
#include <yaz/wrbuf.h>
#include <yaz/proto.h>
#include <yaz/nmem_xml.h>
#include "sru-p.h"
#include <libxml/parser.h>
#include <libxml/tree.h>
Go to the source code of this file.
Functions | |
static void | extract_text_node (xmlNodePtr node, WRBUF wrbuf) |
static int | match_xml_node_attribute (xmlNodePtr ptr, const char *node_name, const char *attribute_name, const char *value) |
static void | yaz_solr_decode_result_docs (ODR o, xmlNodePtr ptr, Odr_int start, Z_SRW_searchRetrieveResponse *sr) |
static int | yaz_solr_decode_result (ODR o, xmlNodePtr ptr, Z_SRW_searchRetrieveResponse *sr) |
static const char * | get_facet_term_count (ODR o, xmlNodePtr node, Odr_int *freq) |
Z_FacetField * | yaz_solr_decode_facet_field (ODR o, xmlNodePtr ptr, Z_SRW_searchRetrieveResponse *sr) |
static int | yaz_solr_decode_facet_counts (ODR o, xmlNodePtr root, Z_SRW_searchRetrieveResponse *sr) |
static void | yaz_solr_decode_suggestion_values (xmlNodePtr listPptr, WRBUF wrbuf) |
static void | yaz_solr_decode_suggestion_lst (xmlNodePtr lstPtr, WRBUF wrbuf) |
static void | yaz_solr_decode_misspelled (xmlNodePtr lstPtr, WRBUF wrbuf) |
static int | yaz_solr_decode_spellcheck (ODR o, xmlNodePtr spellcheckPtr, Z_SRW_searchRetrieveResponse *sr) |
static int | yaz_solr_decode_scan_result (ODR o, xmlNodePtr ptr, Z_SRW_scanResponse *scr) |
static int | yaz_solr_decode_error (ODR o, xmlNode *ptr, Z_SRW_searchRetrieveResponse *sr) |
int | yaz_solr_decode_response (ODR o, Z_HTTP_Response *hres, Z_SRW_PDU **pdup) |
decode SOLR response (HTTP) More... | |
static int | yaz_solr_encode_facet_field (ODR encode, char **name, char **value, int *i, Z_FacetField *facet_field) |
static int | yaz_solr_encode_facet_list (ODR encode, char **name, char **value, int *i, Z_FacetList *facet_list) |
int | yaz_solr_encode_request (Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, ODR encode, const char *charset) |
encode SOLR request (HTTP) More... | |
Implements Solr decoding/encoding.
Definition in file solr.c.
|
static |
Definition at line 30 of file solr.c.
References node(), and wrbuf_xmlputs().
Referenced by yaz_solr_decode_suggestion_values().
Definition at line 125 of file solr.c.
References nmem_text_node_cdata(), node(), odr_atoi(), odr_getmem, and yaz_element_attribute_value_get().
Referenced by yaz_solr_decode_facet_field(), and yaz_solr_decode_scan_result().
|
static |
Definition at line 38 of file solr.c.
References yaz_element_attribute_value_get().
Referenced by yaz_solr_decode_error(), yaz_solr_decode_facet_counts(), yaz_solr_decode_response(), yaz_solr_decode_spellcheck(), yaz_solr_decode_suggestion_lst(), and yaz_solr_decode_suggestion_values().
|
static |
Definition at line 324 of file solr.c.
References Z_SRW_searchRetrieveResponse::diagnostics, match_xml_node_attribute(), nmem_text_node_cdata(), Z_SRW_searchRetrieveResponse::num_diagnostics, odr_getmem, yaz_add_srw_diagnostic(), and YAZ_SRW_UNSUPP_PARAMETER_VALUE.
Referenced by yaz_solr_decode_response().
|
static |
Definition at line 168 of file solr.c.
References facet_list_create(), facet_list_field_set(), Z_SRW_searchRetrieveResponse::facetList, match_xml_node_attribute(), node(), Z_FacetList::num, and yaz_solr_decode_facet_field().
Referenced by yaz_solr_decode_response().
Z_FacetField* yaz_solr_decode_facet_field | ( | ODR | o, |
xmlNodePtr | ptr, | ||
Z_SRW_searchRetrieveResponse * | sr | ||
) |
Definition at line 135 of file solr.c.
References facet_field_create(), facet_field_term_set(), facet_term_create_cstr(), get_facet_term_count(), name, node(), Z_FacetField::num_terms, yaz_element_attribute_value_get(), and zget_AttributeList_use_string().
Referenced by yaz_solr_decode_facet_counts().
|
static |
Definition at line 228 of file solr.c.
References node(), wrbuf_printf(), wrbuf_puts(), wrbuf_xmlputs(), yaz_element_attribute_value_get(), and yaz_solr_decode_suggestion_lst().
Referenced by yaz_solr_decode_spellcheck().
int yaz_solr_decode_response | ( | ODR | o, |
Z_HTTP_Response * | hres, | ||
Z_SRW_PDU ** | pdup | ||
) |
decode SOLR response (HTTP)
o | ODR for result |
hres | HTTP response to be decoded |
pdup | SRW response pointer (set if successful) |
-1 | fail |
0 | OK |
Definition at line 340 of file solr.c.
References Z_HTTP_Response::content_buf, Z_HTTP_Response::content_len, match_xml_node_attribute(), Z_SRW_searchRetrieveResponse::numberOfRecords, Z_SRW_PDU::response, Z_SRW_PDU::scan_response, Z_SRW_PDU::u, yaz_solr_decode_error(), yaz_solr_decode_facet_counts(), yaz_solr_decode_result(), yaz_solr_decode_scan_result(), yaz_solr_decode_spellcheck(), yaz_srw_get(), Z_SRW_scan_response, and Z_SRW_searchRetrieve_response.
Referenced by ZOOM_handle_sru().
|
static |
Definition at line 100 of file solr.c.
References Z_SRW_searchRetrieveResponse::numberOfRecords, odr_atoi(), odr_intdup(), and yaz_solr_decode_result_docs().
Referenced by yaz_solr_decode_response().
|
static |
Definition at line 57 of file solr.c.
References node(), Z_SRW_searchRetrieveResponse::num_records, odr_intdup(), odr_malloc(), odr_strdupn(), Z_SRW_record::recordData_buf, Z_SRW_record::recordData_len, Z_SRW_record::recordPacking, Z_SRW_record::recordPosition, Z_SRW_searchRetrieveResponse::records, Z_SRW_record::recordSchema, and Z_SRW_recordPacking_XML.
Referenced by yaz_solr_decode_result().
|
static |
Definition at line 262 of file solr.c.
References Z_SRW_scanTerm::displayTerm, get_facet_term_count(), node(), Z_SRW_scanResponse::num_terms, Z_SRW_scanTerm::numberOfRecords, odr_intdup(), odr_malloc(), odr_strdup(), Z_SRW_scanResponse::terms, Z_SRW_scanTerm::value, and Z_SRW_scanTerm::whereInList.
Referenced by yaz_solr_decode_response().
|
static |
Definition at line 249 of file solr.c.
References match_xml_node_attribute(), odr_strdup(), Z_SRW_searchRetrieveResponse::suggestions, wrbuf_alloc(), wrbuf_cstr(), wrbuf_destroy(), and yaz_solr_decode_misspelled().
Referenced by yaz_solr_decode_response().
|
static |
Definition at line 220 of file solr.c.
References match_xml_node_attribute(), node(), and yaz_solr_decode_suggestion_values().
Referenced by yaz_solr_decode_misspelled().
|
static |
Definition at line 200 of file solr.c.
References extract_text_node(), match_xml_node_attribute(), node(), and wrbuf_puts().
Referenced by yaz_solr_decode_suggestion_lst().
|
static |
Definition at line 405 of file solr.c.
References Z_FacetField::attributes, yaz_facet_attr::errcode, yaz_facet_attr::limit, name, odr_strdup(), yaz_facet_attr::sortorder, yaz_facet_attr::start, yaz_facet_attr::useattr, wrbuf_alloc(), wrbuf_cstr(), wrbuf_destroy(), wrbuf_printf(), wrbuf_rewind(), yaz_add_name_value_int(), yaz_add_name_value_str(), yaz_facet_attr_get_z_attributes(), and yaz_facet_attr_init().
Referenced by yaz_solr_encode_facet_list().
|
static |
Definition at line 472 of file solr.c.
References Z_FacetList::elements, name, Z_FacetList::num, and yaz_solr_encode_facet_field().
Referenced by yaz_solr_encode_request().
int yaz_solr_encode_request | ( | Z_HTTP_Request * | hreq, |
Z_SRW_PDU * | srw_pdu, | ||
ODR | encode, | ||
const char * | charset | ||
) |
encode SOLR request (HTTP)
hreq | HTTP request to be modified (with encoded request) |
srw_pdu | SRW request |
encode | ODR for result |
charset | character set for request (may be NULL) |
-1 | fail |
0 | OK |
Definition at line 488 of file solr.c.
References Z_SRW_PDU::extra_args, Z_HTTP_Request::headers, Z_HTTP_Request::method, name, Z_SRW_extra_arg::name, Z_SRW_extra_arg::next, odr_malloc(), odr_strdup(), Z_SRW_PDU::password, Z_HTTP_Request::path, Z_SRW_searchRetrieveRequest::query, Z_SRW_scanRequest::queryType, Z_SRW_PDU::request, Z_SRW_PDU::scan_request, Z_SRW_scanRequest::scanClause, Z_SRW_searchRetrieveRequest::sort, Z_SRW_searchRetrieveRequest::sort_type, Z_SRW_searchRetrieveRequest::sortKeys, yaz_facet_attr::start, Z_SRW_searchRetrieveRequest::startRecord, Z_SRW_PDU::u, Z_SRW_PDU::username, Z_SRW_extra_arg::value, Z_SRW_PDU::which, yaz_add_name_value_int(), yaz_add_name_value_str(), yaz_array_to_uri(), yaz_solr_encode_facet_list(), z_HTTP_header_add_basic_auth(), Z_SRW_scan_request, Z_SRW_searchRetrieve_request, Z_SRW_sort_type_none, and Z_SRW_sort_type_sort.
Referenced by send_srw().