projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
[yaz-moved-to-github.git]
/
src
/
zoom-sru.c
diff --git
a/src/zoom-sru.c
b/src/zoom-sru.c
index
87155a1
..
105970f
100644
(file)
--- a/
src/zoom-sru.c
+++ b/
src/zoom-sru.c
@@
-1,11
+1,14
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zoom-sru.c
* \brief Implements ZOOM SRU
*/
* See the file LICENSE for details.
*/
/**
* \file zoom-sru.c
* \brief Implements ZOOM SRU
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
#include <assert.h>
#include <string.h>
@@
-13,6
+16,9
@@
#include "zoom-p.h"
#include <yaz/log.h>
#include "zoom-p.h"
#include <yaz/log.h>
+#include <yaz/pquery.h>
+
+void handle_facet_list(ZOOM_resultset r, Z_FacetList *fl);
#if YAZ_HAVE_XML2
static void set_SRU_error(ZOOM_connection c, Z_SRW_diagnostic *d)
#if YAZ_HAVE_XML2
static void set_SRU_error(ZOOM_connection c, Z_SRW_diagnostic *d)
@@
-30,12
+36,10
@@
static zoom_ret send_srw(ZOOM_connection c, Z_SRW_PDU *sr)
Z_GDU *gdu;
ZOOM_Event event;
const char *database = ZOOM_options_get(c->options, "databaseName");
Z_GDU *gdu;
ZOOM_Event event;
const char *database = ZOOM_options_get(c->options, "databaseName");
- char *fdatabase = 0;
-
- if (database)
- fdatabase = yaz_encode_sru_dbpath_odr(c->odr_out, database);
- gdu = z_get_HTTP_Request_host_path(c->odr_out, c->host_port,
- fdatabase ? fdatabase : c->path);
+
+ gdu = z_get_HTTP_Request_uri(c->odr_out, c->host_port,
+ database,
+ c->proxy ? 1 : 0);
if (c->sru_mode == zoom_sru_get)
{
if (c->sru_mode == zoom_sru_get)
{
@@
-132,13
+136,14
@@
zoom_ret ZOOM_connection_srw_send_scan(ZOOM_connection c)
#if YAZ_HAVE_XML2
zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c)
{
#if YAZ_HAVE_XML2
zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c)
{
+ const char *facets = 0;
int i;
int *start, *count;
ZOOM_resultset resultset = 0;
Z_SRW_PDU *sr = 0;
const char *option_val = 0;
Z_Query *z_query;
int i;
int *start, *count;
ZOOM_resultset resultset = 0;
Z_SRW_PDU *sr = 0;
const char *option_val = 0;
Z_Query *z_query;
-
+ Z_FacetList *facet_list = 0;
if (c->error) /* don't continue on error */
return zoom_complete;
assert(c->tasks);
if (c->error) /* don't continue on error */
return zoom_complete;
assert(c->tasks);
@@
-151,6
+156,9
@@
zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c)
ZOOM_options_set(resultset->options, "setname", resultset->setname);
start = &c->tasks->u.search.start;
count = &c->tasks->u.search.count;
ZOOM_options_set(resultset->options, "setname", resultset->setname);
start = &c->tasks->u.search.start;
count = &c->tasks->u.search.count;
+ facets = ZOOM_options_get(resultset->options, "facets");
+ if (facets)
+ facet_list = yaz_pqf_parse_facet_list(c->odr_out, facets);
break;
case ZOOM_TASK_RETRIEVE:
resultset = c->tasks->u.retrieve.resultset;
break;
case ZOOM_TASK_RETRIEVE:
resultset = c->tasks->u.retrieve.resultset;
@@
-213,6
+221,7
@@
zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c)
c->odr_out, (resultset->step > 0 && resultset->step < *count) ?
resultset->step : *count);
sr->u.request->recordSchema = resultset->schema;
c->odr_out, (resultset->step > 0 && resultset->step < *count) ?
resultset->step : *count);
sr->u.request->recordSchema = resultset->schema;
+ sr->u.request->facetList = facet_list;
option_val = ZOOM_resultset_option_get(resultset, "recordPacking");
if (option_val)
option_val = ZOOM_resultset_option_get(resultset, "recordPacking");
if (option_val)
@@
-252,12
+261,15
@@
static zoom_ret handle_srw_response(ZOOM_connection c,
syntax = c->tasks->u.search.syntax;
elementSetName = c->tasks->u.search.elementSetName;
syntax = c->tasks->u.search.syntax;
elementSetName = c->tasks->u.search.elementSetName;
- if (!c->tasks->u.search.recv_search_fired)
- {
+ /* Required not for reporting client hit count multiple times into session */
+ if (!c->tasks->u.search.recv_search_fired) {
+ yaz_log(YLOG_DEBUG, "posting ZOOM_EVENT_RECV_SEARCH");
event = ZOOM_Event_create(ZOOM_EVENT_RECV_SEARCH);
ZOOM_connection_put_event(c, event);
c->tasks->u.search.recv_search_fired = 1;
}
event = ZOOM_Event_create(ZOOM_EVENT_RECV_SEARCH);
ZOOM_connection_put_event(c, event);
c->tasks->u.search.recv_search_fired = 1;
}
+ if (res->facetList)
+ handle_facet_list(resultset, res->facetList);
break;
case ZOOM_TASK_RETRIEVE:
resultset = c->tasks->u.retrieve.resultset;
break;
case ZOOM_TASK_RETRIEVE:
resultset = c->tasks->u.retrieve.resultset;
@@
-285,7
+297,6
@@
static zoom_ret handle_srw_response(ZOOM_connection c,
{
if (res->numberOfRecords) {
resultset->size = *res->numberOfRecords;
{
if (res->numberOfRecords) {
resultset->size = *res->numberOfRecords;
- yaz_log(YLOG_DEBUG, "res numberOfRecords " ODR_INT_PRINTF, *res->numberOfRecords);
}
for (i = 0; i<res->num_records; i++)
{
}
for (i = 0; i<res->num_records; i++)
{
@@
-305,8
+316,7
@@
static zoom_ret handle_srw_response(ZOOM_connection c,
pos = *res->records[i].recordPosition - 1;
else
pos = *start + i;
pos = *res->records[i].recordPosition - 1;
else
pos = *start + i;
- yaz_log(YLOG_DEBUG, "pos %d start %d ", pos, *start);
-
+
sru_rec = &res->records[i];
npr->databaseName = 0;
sru_rec = &res->records[i];
npr->databaseName = 0;
@@
-316,6
+326,7
@@
static zoom_ret handle_srw_response(ZOOM_connection c,
npr->u.databaseRecord->descriptor = 0;
npr->u.databaseRecord->direct_reference =
odr_oiddup(c->odr_in, yaz_oid_recsyn_xml);
npr->u.databaseRecord->descriptor = 0;
npr->u.databaseRecord->direct_reference =
odr_oiddup(c->odr_in, yaz_oid_recsyn_xml);
+ npr->u.databaseRecord->indirect_reference = 0;
npr->u.databaseRecord->which = Z_External_octet;
npr->u.databaseRecord->u.octet_aligned = (Odr_oct *)
npr->u.databaseRecord->which = Z_External_octet;
npr->u.databaseRecord->u.octet_aligned = (Odr_oct *)
@@
-382,6
+393,7
@@
static void handle_srw_scan_response(ZOOM_connection c,
int ZOOM_handle_sru(ZOOM_connection c, Z_HTTP_Response *hres,
zoom_ret *cret)
{
int ZOOM_handle_sru(ZOOM_connection c, Z_HTTP_Response *hres,
zoom_ret *cret)
{
+#if YAZ_HAVE_XML2
int ret = 0;
const char *addinfo = 0;
int ret = 0;
const char *addinfo = 0;
@@
-436,6
+448,9
@@
int ZOOM_handle_sru(ZOOM_connection c, Z_HTTP_Response *hres,
ret = -1;
}
return ret;
ret = -1;
}
return ret;
+#else
+ return -1;
+#endif
}
/*
}
/*