42 #include <yaz/marcdisp.h>
43 #include <yaz/comstack.h>
44 #include <yaz/tcpip.h>
45 #include <yaz/proto.h>
46 #include <yaz/readconf.h>
47 #include <yaz/pquery.h>
48 #include <yaz/otherinfo.h>
49 #include <yaz/yaz-util.h>
51 #include <yaz/query-charset.h>
52 #include <yaz/querytowrbuf.h>
53 #include <yaz/oid_db.h>
54 #include <yaz/diagbib1.h>
55 #include <yaz/snprintf.h>
56 #include <yaz/rpn2cql.h>
57 #include <yaz/rpn2solr.h>
58 #include <yaz/gettimeofday.h>
62 #include <yaz/timing.h>
74 #define XDOC_CACHE_SIZE 100
88 yaz_log(YLOG_DEBUG,
"%s clients=%d",
89 delta == 0 ?
"" : (delta > 0 ?
"INC" :
"DEC"), clients);
158 "Client_Disconnected"
189 yaz_log(YLOG_DEBUG,
"%s: releasing watches on zero active: %d",
191 if (no_active == 0) {
216 xmlFreeDoc(cl->
xdoc[i]);
224 return cl->
xdoc[record_no];
233 if (cl->
xdoc[record_no])
234 xmlFreeDoc(cl->
xdoc[record_no]);
235 cl->
xdoc[record_no] = xdoc;
267 void (*error_handler)(
void *data,
const char *addinfo),
268 void (*record_handler)(
void *data,
const char *buf,
size_t sz),
270 const char *nativesyntax)
279 error_handler(data,
"no resultset");
282 rec = ZOOM_resultset_record_immediate(resultset, position-1);
285 error_handler(data,
"no record");
289 buf = ZOOM_record_get(rec, type, &len);
292 error_handler(data,
"no record");
295 record_handler(data, buf, len);
300 const char *syntax,
const char *esn,
302 void (*error_handler)(
void *data,
const char *addinfo),
303 void (*record_handler)(
void *data,
const char *buf,
306 const char *nativesyntax)
311 nativesyntax =
"raw";
319 if (syntax == 0 && esn == 0)
322 error_handler, record_handler,
323 binary, nativesyntax);
332 rr = xmalloc(
sizeof(*rr));
418 const char *syntax = 0;
419 const char *elements = 0;
424 yaz_log(YLOG_DEBUG,
"%s: trying to present %d record(s) from %d",
431 ZOOM_resultset_option_set(set,
"preferredRecordSyntax", syntax);
437 if (elements && *elements)
438 ZOOM_resultset_option_set(set,
"elementSetName", elements);
440 ZOOM_resultset_records(set, 0, offset-1, 1);
451 if (!strncmp(s,
"iso2709", 7))
453 const char *cp = strchr(s,
';');
454 yaz_snprintf(type, 80,
"xml; charset=%s", cp ? cp+1 :
"marc-8s");
456 else if (!strncmp(s,
"txml", 4))
458 const char *cp = strchr(s,
';');
459 yaz_snprintf(type, 80,
"txml; charset=%s", cp ? cp+1 :
"marc-8s");
467 const char *syntax = ZOOM_record_get(rec,
"syntax", NULL);
470 if (!strcmp(syntax,
"XML"))
475 else if (!strcmp(syntax,
"USmarc") || !strcmp(syntax,
"MARC21"))
477 strcpy(type,
"xml; charset=marc8-s");
493 ZOOM_facet_field *facets = ZOOM_resultset_facets(rs);
498 int facet_num = ZOOM_resultset_facets_size(rs);
503 const char *p = strchr(s->
name + 3,
':');
508 for (facet_idx = 0; facet_idx < facet_num; facet_idx++)
510 const char *native_name =
511 ZOOM_facet_field_name(facets[facet_idx]);
512 if (native_name && !strcmp(s->
value, native_name))
516 ZOOM_facet_field_term_count(facets[facet_idx]);
517 for (term_idx = 0; term_idx < term_num; term_idx++ )
521 ZOOM_facet_field_get_term(facets[facet_idx],
541 buf = ZOOM_record_get(rec, type, &len);
553 ZOOM_resultset resultset = cl->
resultset;
556 const char *
error, *addinfo = 0;
558 if (ZOOM_connection_error(link, &
error, &addinfo))
569 cl->
hits = ZOOM_resultset_size(resultset);
570 session_log(se, YLOG_LOG,
"%s: hits: " ODR_INT_PRINTF,
576 resultset,
"suggestions"));
604 const char *msg, *addinfo;
606 ZOOM_resultset resultset = cl->
resultset;
616 NMEM
nmem = nmem_create();
621 "%s: #%d: failed to ingest xdoc",
630 else if ((rec = ZOOM_resultset_record_immediate(resultset,
635 else if (ZOOM_record_error(rec, &msg, &addinfo, 0))
637 session_log(se, YLOG_WARN,
"Record error %s (%s): %s #%d",
644 NMEM nmem = nmem_create();
650 session_log(se, YLOG_WARN,
"Failed to determine record type");
651 xmlrec = ZOOM_record_get(rec, type, NULL);
654 const char *rec_syn = ZOOM_record_get(rec,
"syntax", NULL);
655 session_log(se, YLOG_WARN,
"%s: #%d: ZOOM_record_get failed",
658 "ZOOM record type=%s . Actual record syntax=%s",
659 s ? s :
"null", type,
660 rec_syn ? rec_syn :
"null");
669 const char *rec_syn = ZOOM_record_get(rec,
"syntax", NULL);
671 "%s: #%d: failed to ingest record",
674 "ZOOM record type=%s . Actual record syntax=%s",
675 s ? s :
"null", type,
676 rec_syn ? rec_syn :
"null");
687 session_log(se, YLOG_WARN,
"Got NULL record from %s #%d",
697 ZOOM_resultset resultset = cl->
resultset;
698 const char *
error, *addinfo;
700 if (ZOOM_connection_error(
link, &
error, &addinfo))
712 if ((rec = ZOOM_resultset_record_immediate(
720 yaz_log(YLOG_WARN,
"Expected record, but got NULL, offset=%d",
748 WRBUF w = wrbuf_alloc();
754 const char *p = strchr(s->
name + 3,
':');
757 yaz_log(YLOG_WARN,
"Malformed facetmap name: %s", s->
name);
761 wrbuf_puts(w,
"@attr 1=");
762 yaz_encode_pqf_term(w, s->
value, strlen(s->
value));
767 yaz_log(YLOG_DEBUG,
"using facets str: %s", wrbuf_cstr(w));
768 ZOOM_connection_option_set(link,
"facets",
769 wrbuf_len(w) ? wrbuf_cstr(w) : 0);
780 const char *p = strchr(s->
name + 3,
':');
781 if ( !strncmp(p,
":split:", 7) )
783 if (p && !strcmp(
name, p + 1))
794 const char *strategy_plus_sort = 0;
798 char *p = strchr(s->
name + 3,
':');
801 yaz_log(YLOG_WARN,
"Malformed sortmap name: %s", s->
name);
805 if (!strcmp(p, field))
807 strategy_plus_sort = s->
value;
811 return strategy_plus_sort;
834 extend_recs = atoi(str);
836 yaz_log(YLOG_DEBUG,
"cl=%s show_stat_no=%d got=%d",
841 yaz_log(YLOG_DEBUG,
"cl=%s Trying to fetch more",
client_get_id(cl));
843 if (number > extend_recs)
844 number = extend_recs;
846 yaz_log(YLOG_DEBUG,
"cl=%s. OK no more in total set",
client_get_id(cl));
848 yaz_log(YLOG_DEBUG,
"cl=%s. No connection",
client_get_id(cl));
854 ZOOM_resultset_option_set(set,
"preferredRecordSyntax", str);
857 ZOOM_resultset_option_set(set,
"elementSetName", str);
879 if (maxrecs && atoi(maxrecs) != cl->
maxrecs)
885 if (startrecs && atoi(startrecs) != cl->
startrecs)
899 return nmem_strdup(nmem, cl->
pquery);
904 return nmem_strdup(nmem, cl->
cqlquery);
914 ZOOM_connection
link = 0;
929 char maxrecs_str[24], startrecs_str[24], present_chunk_str[24];
931 int present_chunk = 20;
932 int rc_prep_connection;
938 yaz_gettimeofday(&tval);
941 if (opt_timeout && *opt_timeout)
942 operation_timeout = atoi(opt_timeout);
944 if (opt_present_chunk && strcmp(opt_present_chunk,
"")) {
945 present_chunk = atoi(opt_present_chunk);
946 yaz_log(YLOG_DEBUG,
"Present chunk set to %d", present_chunk);
954 if (cl->
same_search == 1 && rc_prep_connection == 2)
960 else if (!rc_prep_connection)
972 if (extra_args && *extra_args)
973 ZOOM_connection_option_set(link,
"extraArgs", extra_args);
978 yaz_log(YLOG_LOG,
"Target %s has preferred status: %d",
983 ZOOM_connection_option_set(link,
"piggyback", opt_piggyback);
985 ZOOM_connection_option_set(link,
"piggyback",
"1");
987 ZOOM_connection_option_set(link,
"rpnCharset", opt_queryenc);
988 if (*opt_sru && *opt_elements)
989 ZOOM_connection_option_set(link,
"schema", opt_elements);
990 else if (*opt_elements)
991 ZOOM_connection_option_set(link,
"elementSetName", opt_elements);
993 ZOOM_connection_option_set(link,
"preferredRecordSyntax", opt_requestsyn);
995 if (opt_maxrecs && *opt_maxrecs)
997 cl->
maxrecs = atoi(opt_maxrecs);
1001 sprintf(maxrecs_str,
"%d", cl->
maxrecs);
1002 ZOOM_connection_option_set(link,
"count", maxrecs_str);
1005 if (present_chunk > 0 && cl->
maxrecs > present_chunk) {
1006 sprintf(present_chunk_str,
"%d", present_chunk);
1007 ZOOM_connection_option_set(link,
"presentChunk", present_chunk_str);
1008 yaz_log(YLOG_DEBUG,
"Present chunk set to %s", present_chunk_str);
1011 ZOOM_connection_option_set(link,
"presentChunk", maxrecs_str);
1012 yaz_log(YLOG_DEBUG,
"Present chunk set to %s (maxrecs)", maxrecs_str);
1014 sprintf(startrecs_str,
"%d", cl->
startrecs);
1015 ZOOM_connection_option_set(link,
"start", startrecs_str);
1021 query = ZOOM_query_create();
1026 ZOOM_query_cql(query, cl->
cqlquery);
1028 ZOOM_query_sortby(query, opt_sort);
1034 ZOOM_query_prefix(query, cl->
pquery);
1037 yaz_log(YLOG_LOG,
"Client %s: "
1038 "Set ZOOM sort strategy and criteria: %s %s",
1043 yaz_log(YLOG_DEBUG,
"Client %s: Starting search",
client_get_id(cl));
1047 rs = ZOOM_connection_search(link, query);
1048 ZOOM_query_destroy(query);
1057 struct client *cl = xmalloc(
sizeof(*cl));
1083 cl->
id = xstrdup(
id);
1087 yaz_log(YLOG_DEBUG,
"client_create c=%p %s", cl,
id);
1093 yaz_mutex_enter(c->
mutex);
1098 yaz_mutex_leave(c->
mutex);
1104 yaz_log(YLOG_DEBUG,
"client_incref c=%p %s cnt=%d",
1112 yaz_log(YLOG_DEBUG,
"client_destroy c=%p %s cnt=%d",
1135 yaz_mutex_destroy(&c->
mutex);
1181 yaz_log(YLOG_LOG,
"client_stop: %s release",
client_get_id(cl));
1192 yaz_log(YLOG_LOG,
"client_stop: %s ignore",
client_get_id(cl));
1206 res = ccl_qual_dup(base_bibset);
1208 res = ccl_qual_mk();
1211 const char *addinfo = 0;
1212 char *p = strchr(s->
name + 3,
':');
1215 WRBUF w = wrbuf_alloc();
1216 wrbuf_printf(w,
"Malformed cclmap. name=%s", s->
name);
1217 yaz_log(YLOG_WARN,
"%s: %s",
client_get_id(cl), wrbuf_cstr(w));
1219 ZOOM_diag_str(ZOOM_ERROR_CCL_CONFIG),
1227 if (ccl_qual_fitem2(res, s->
value, p, &addinfo))
1229 WRBUF w = wrbuf_alloc();
1231 wrbuf_printf(w,
"Malformed cclmap. name=%s: value=%s (%s)",
1232 s->
name, p, addinfo);
1233 yaz_log(YLOG_WARN,
"%s: %s",
client_get_id(cl), wrbuf_cstr(w));
1235 ZOOM_diag_str(ZOOM_ERROR_CCL_CONFIG),
1249 cql_transform_t cqlt = cql_transform_create();
1251 WRBUF wrb = wrbuf_alloc();
1254 if ((status = cql_transform_rpn2cql_wrbuf(cqlt, wrb, zquery)))
1256 yaz_log(YLOG_WARN,
"Failed to generate CQL query, code=%d", status);
1260 r = xstrdup(wrbuf_cstr(wrb));
1263 cql_transform_close(cqlt);
1271 solr_transform_t sqlt = solr_transform_create();
1273 WRBUF wrb = wrbuf_alloc();
1276 if ((status = solr_transform_rpn2solr_wrbuf(sqlt, wrb, zquery)))
1278 yaz_log(YLOG_WARN,
"Failed to generate SOLR query, code=%d", status);
1282 r = xstrdup(wrbuf_cstr(wrb));
1285 solr_transform_close(sqlt);
1292 NMEM nmem,
int *num,
char ***values)
1294 const char *
name = 0;
1295 const char *
value = 0;
1302 const char *p = strchr(s->
name + 3,
':');
1303 if (p && !strcmp(p + 1,
name) && s->
value)
1307 nmem_strsplit_escape2(nmem,
",", s->
value, &cvalues,
1309 for (j = 0; j < cnum; j++)
1311 const char *cvalue = cvalues[j];
1312 while (*cvalue ==
' ')
1314 if (!strncmp(cvalue,
"local:", 6))
1316 const char *cp = cvalue + 6;
1319 nmem_strsplit_escape2(nmem,
"|",
value, values,
1322 return *cp ? cp :
name;
1336 for (cp = term; *cp; cp++)
1337 if ((*cp >=
'0' && *cp <=
'9') || strchr(
" +-", *cp))
1342 wrbuf_puts(w, term);
1345 wrbuf_putc(w,
'\"');
1346 for (cp = term; *cp; cp++)
1348 if (strchr(
"\\\"", *cp))
1349 wrbuf_putc(w,
'\\');
1352 wrbuf_putc(w,
'\"');
1358 WRBUF w_pqf, CCL_bibset ccl_map,
1367 NMEM nmem_tmp = nmem_create();
1371 nmem_reset(nmem_tmp);
1375 const char *p = strchr(s->
name + 3,
':');
1376 if (p && !strcmp(p + 1,
name) && s->
value)
1382 nmem_strsplit_escape2(nmem_tmp,
"|",
value, &values,
1385 for (i = 0; i < num; i++)
1394 values[i] = nmem_strdup(nmem_tmp,
id);
1396 "apply_limit: s='%s' found id '%s'",s->
name,
id );
1401 "apply_limit: %s: term '%s' not found, failing client",
1402 s->
name, values[i] );
1407 nmem_strsplit_escape2(nmem_tmp,
",", s->
value, &cvalues,
1410 for (j = 0; ret == 0 && j < cnum; j++)
1412 const char *cvalue = cvalues[j];
1413 while (*cvalue ==
' ')
1415 if (!strncmp(cvalue,
"rpn:", 4))
1417 const char *pqf = cvalue + 4;
1418 wrbuf_puts(w_pqf,
"@and ");
1419 wrbuf_puts(w_pqf, pqf);
1420 wrbuf_puts(w_pqf,
" ");
1421 for (i = 0; i < num; i++)
1424 wrbuf_puts(w_pqf,
"@or ");
1425 yaz_encode_pqf_term(w_pqf, values[i],
1429 else if (!strncmp(cvalue,
"ccl:", 4))
1431 const char *ccl = cvalue + 4;
1432 WRBUF ccl_w = wrbuf_alloc();
1433 for (i = 0; i < num; i++)
1436 struct ccl_rpn_node *cn;
1437 wrbuf_rewind(ccl_w);
1438 wrbuf_puts(ccl_w, ccl);
1439 wrbuf_putc(ccl_w,
'=');
1441 cn = ccl_find_str(ccl_map, wrbuf_cstr(ccl_w),
1446 wrbuf_printf(w_pqf,
"@and ");
1452 wrbuf_printf(w_pqf,
"@or ");
1453 ccl_pquery(w_pqf, cn);
1457 wrbuf_destroy(ccl_w);
1459 else if (!strncmp(cvalue,
"local:", 6)) {
1464 yaz_log(YLOG_WARN,
"Target %s: Bad limitmap '%s'",
1480 yaz_log(YLOG_LOG,
"limitcluster in use for %s",
1487 yaz_log(YLOG_WARN,
"Target %s: limit %s used, but no limitmap defined",
1492 nmem_destroy(nmem_tmp);
1508 struct ccl_rpn_node *cn;
1526 w_ccl = wrbuf_alloc();
1527 wrbuf_puts(w_ccl, query);
1529 w_pqf = wrbuf_alloc();
1532 wrbuf_puts(w_pqf, pqf_prefix);
1533 wrbuf_puts(w_pqf,
" ");
1539 ccl_qual_rm(&ccl_map);
1541 wrbuf_destroy(w_ccl);
1542 wrbuf_destroy(w_pqf);
1553 cn = ccl_find_str(ccl_map, wrbuf_cstr(w_ccl), &cerror, &cpos);
1554 ccl_qual_rm(&ccl_map);
1558 *error_msg = ccl_err_msg(cerror);
1560 session_log(se, YLOG_WARN,
"Client %s: Failed to parse CCL query '%s'",
1563 wrbuf_destroy(w_ccl);
1564 wrbuf_destroy(w_pqf);
1571 wrbuf_destroy(w_ccl);
1573 if (!pqf_strftime || !*pqf_strftime)
1574 ccl_pquery(w_pqf, cn);
1577 time_t cur_time = time(0);
1578 struct tm *tm = localtime(&cur_time);
1580 const char *cp = tmp_str;
1584 strftime(tmp_str,
sizeof(tmp_str)-1, pqf_strftime, tm);
1588 ccl_pquery(w_pqf, cn);
1590 wrbuf_putc(w_pqf, cp[0]);
1595 if (!cl->
pquery || strcmp(cl->
pquery, wrbuf_cstr(w_pqf)))
1599 "Re-search due query/limit change: %s to %s",
1602 cl->
pquery = xstrdup(wrbuf_cstr(w_pqf));
1608 wrbuf_destroy(w_pqf);
1610 odr_out = odr_createmem(ODR_ENCODE);
1611 zquery = p_query_rpn(odr_out, cl->
pquery);
1614 session_log(se, YLOG_WARN,
"Invalid PQF query for Client %s: %s",
1617 *error_msg =
"Invalid PQF after CCL to PQF conversion";
1622 if (strcmp(query_syntax,
"pqf") != 0 && *sru)
1624 if (!strcmp(sru,
"solr"))
1630 *error_msg =
"Cannot convert PQF to Solr/CQL";
1634 session_log(se, YLOG_LOG,
"Client %s native query: %s (%s)",
1638 odr_destroy(odr_out);
1661 const char *sort_strategy_and_spec =
1664 if (!strcmp(sp->
name,
"relevance"))
1666 if (sort_strategy_and_spec && strlen(sort_strategy_and_spec) < 40)
1668 char strategy[50], *p;
1669 strcpy(strategy, sort_strategy_and_spec);
1670 p = strchr(strategy,
':');
1681 yaz_log(YLOG_LOG,
"Client %s: "
1698 yaz_log(YLOG_LOG,
"Client %s: "
1699 "Invalid sort strategy and spec found %s",
1709 yaz_log(YLOG_DEBUG,
"Client %s: "
1757 yaz_log(YLOG_DEBUG,
"%s: Approx: %lld * %d / %d = %lld ",
1778 const char *message,
const char *addinfo)
1782 cl->
message = xstrdup(message);
1786 cl->
addinfo = xstrdup(addinfo);
1790 const char **addinfo)
1808 yaz_log(YLOG_DEBUG,
"Passthrough Suggestions: \n%s\n",
1825 return wrbuf_cstr(wrbuf);
1854 if (suggestions_string == 0 || suggestions_string[0] == 0 )
1856 nmem = nmem_create();
1858 yaz_log(YLOG_DEBUG,
"client target suggestions: %s.", suggestions_string);
1866 if (suggestions_string)
int client_get_diagnostic(struct client *cl, const char **message, const char **addinfo)
static void client_show_raw_error(struct client *cl, const char *addinfo)
void client_got_records(struct client *cl)
void client_unlock(struct client *c)
void client_store_xdoc(struct client *cl, int record_no, xmlDoc *xdoc)
int clients_get_count(void)
int client_parse_query(struct client *cl, const char *query, facet_limits_t facet_limits, const char **error_msg)
static int nativesyntax_to_type(const char *s, char *type, ZOOM_record rec)
void client_set_database(struct client *cl, struct session_database *db)
void client_update_show_stat(struct client *cl, int cmd)
void client_set_connection(struct client *cl, struct connection *con)
static const char * get_strategy_plus_sort(struct client *l, const char *field)
static void client_show_raw_delete(struct show_raw *r)
void client_stop(struct client *cl)
int client_parse_sort(struct client *cl, struct reclist_sortparms *sp, int *has_sortmap)
void client_set_state_nb(struct client *cl, enum client_state st)
static void client_show_immediate(ZOOM_resultset resultset, struct session_database *sdb, int position, void *data, void(*error_handler)(void *data, const char *addinfo), void(*record_handler)(void *data, const char *buf, size_t sz), int binary, const char *nativesyntax)
static int client_use(int delta)
Odr_int client_get_hits(struct client *cl)
void client_set_diagnostic(struct client *cl, int diagnostic, const char *message, const char *addinfo)
int client_fetch_more(struct client *cl)
static char * make_solrquery(struct client *cl, Z_RPNQuery *zquery)
const char * client_get_state_str(struct client *cl)
void client_search_response(struct client *cl)
struct suggestions * client_suggestions_create(const char *suggestions_string)
void client_incref(struct client *c)
int client_is_active_preferred(struct client *cl)
void client_lock(struct client *c)
const char * client_get_id(struct client *cl)
static void client_init_xdoc(struct client *cl)
const char * client_get_facet_limit_local(struct client *cl, struct session_database *sdb, int *l, NMEM nmem, int *num, char ***values)
int client_show_raw_begin(struct client *cl, int position, const char *syntax, const char *esn, void *data, void(*error_handler)(void *data, const char *addinfo), void(*record_handler)(void *data, const char *buf, size_t sz), int binary, const char *nativesyntax)
Odr_int client_get_approximation(struct client *cl)
static void ccl_quote_map_term(CCL_bibset ccl_map, WRBUF w, const char *term)
void client_set_state(struct client *cl, enum client_state st)
struct connection * client_get_connection(struct client *cl)
void client_set_session(struct client *cl, struct session *se)
static CCL_bibset prepare_cclmap(struct client *cl, CCL_bibset base_bibset)
int client_reingest(struct client *cl)
struct client * client_create(const char *id)
static void client_destroy_xdoc(struct client *cl)
int client_start_search(struct client *cl)
static void client_report_facets(struct client *cl, ZOOM_resultset rs)
struct session * client_get_session(struct client *cl)
static const char * client_states[]
int client_get_maxrecs(struct client *cl)
int client_has_facet(struct client *cl, const char *name)
void client_show_raw_remove(struct client *cl, void *data)
int client_parse_range(struct client *cl, const char *startrecs, const char *maxrecs)
void client_mark_dead(struct client *cl)
static void client_send_raw_present(struct client *cl)
xmlDoc * client_get_xdoc(struct client *cl, int record_no)
static char * make_cqlquery(struct client *cl, Z_RPNQuery *zquery)
enum client_state client_get_state(struct client *cl)
static void ingest_raw_record(struct client *cl, ZOOM_record rec)
static int apply_limit(struct client *cl, facet_limits_t facet_limits, WRBUF w_pqf, CCL_bibset ccl_map, struct conf_service *service)
static void client_record_ingest(struct client *cl)
int client_is_active(struct client *cl)
int client_parse_init(struct client *cl, int same_search)
const char * client_get_suggestions_xml(struct client *cl, WRBUF wrbuf)
int client_destroy(struct client *c)
static void client_suggestions_destroy(struct client *cl)
static void client_set_facets_request(struct client *cl, ZOOM_connection link)
void client_record_response(struct client *cl, int *got_records)
const char * client_get_query(struct client *cl, const char **type, NMEM nmem)
struct session_database * client_get_database(struct client *cl)
int client_get_num_records(struct client *cl, int *filtered, int *ingest, int *failed)
void client_disconnect(struct client *cl)
void client_set_preferred(struct client *cl, int v)
static void client_show_raw_dequeue(struct client *cl)
int client_prep_connection(struct client *cl, int operation_timeout, int session_timeout, iochan_man_t iochan, const struct timeval *abstime)
ZOOM_connection connection_get_link(struct connection *co)
void connection_continue(struct connection *co)
void connection_mark_dead(struct connection *co)
void connection_release2(struct connection *co)
Z39.50 connection (low-level client)
const char * facet_limits_get(facet_limits_t fl, int idx, const char **value)
void facet_limits_destroy(facet_limits_t fl)
facet_limits_t facet_limits_dup(facet_limits_t fl)
static void error(struct http_response *rs, enum pazpar2_error_code code, const char *addinfo)
int pazpar2_decref(int *ref, YAZ_MUTEX mutex)
void pazpar2_incref(int *ref, YAZ_MUTEX mutex)
MUTEX protect ref counts.
void pazpar2_mutex_create(YAZ_MUTEX *p, const char *name)
int reclist_get_num_records(struct reclist *l)
struct relevance * relevance_create_ccl(pp2_charset_fact_t pft, struct ccl_rpn_node *query, int rank_cluster, double follow_factor, double lead_decay, int length_divide)
const char * session_setting_oneval(struct session_database *db, int offset)
void session_alert_watch(struct session *s, int what)
int ingest_record(struct client *cl, const char *rec, int record_no, NMEM nmem)
ingest XML record
int ingest_xml_record(struct client *cl, xmlDoc *xdoc, int record_no, NMEM nmem, int cached_copy)
void add_facet(struct session *s, const char *type, const char *value, int count, struct client *cl)
void session_log(struct session *s, int level, const char *fmt,...)
int session_active_clients(struct session *s)
const char * session_lookup_id_facet(struct session *s, struct client *cl, const char *type, const char *term)
int session_is_preferred_clients_ready(struct session *s)
#define SESSION_WATCH_BYTARGET
#define SESSION_WATCH_TERMLIST
#define SESSION_WATCH_SHOW
#define SESSION_WATCH_SHOW_PREF
#define SESSION_WATCH_RECORD
Represents client state for a connection to one search target.
struct show_raw * show_raw
facet_limits_t facet_limits
struct session_database * database
struct suggestions * suggestions
struct connection * connection
int z3950_operation_timeout
pp2_charset_fact_t charsets
struct conf_server * server
int z3950_session_timeout
struct conf_metadata * metadata
Represents a physical, reusable connection to a remote Z39.50 host.
struct database * database
struct setting ** settings
struct conf_service * service
struct relevance * relevance
void(* error_handler)(void *data, const char *addinfo)
void(* record_handler)(void *data, const char *buf, size_t sz)