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 'solr_facets' of ssh://git.indexdata.com/home/git/pub/yaz into solr_facets
[yaz-moved-to-github.git]
/
client
/
client.c
diff --git
a/client/client.c
b/client/client.c
index
d9a98f8
..
3086afe
100644
(file)
--- a/
client/client.c
+++ b/
client/client.c
@@
-1284,7
+1284,7
@@
static int send_srw_host_path(Z_SRW_PDU *sr, const char *host_port,
}
else if (!yaz_matchstr(sru_method, "solr"))
{
}
else if (!yaz_matchstr(sru_method, "solr"))
{
- yaz_solr_encode(gdu->u.HTTP_Request, sr, out, charset);
+ yaz_solr_encode_request(gdu->u.HTTP_Request, sr, out, charset);
}
return send_gdu(gdu);
}
return send_gdu(gdu);
@@
-1454,8
+1454,9
@@
static int send_SRW_searchRequest(const char *arg)
printf("Only CQL and PQF supported in SRW\n");
return 0;
}
printf("Only CQL and PQF supported in SRW\n");
return 0;
}
- sr->u.request->maximumRecords = odr_intdup(out, 0);
-
+ // TODO check.
+ sr->u.request->maximumRecords = odr_intdup(out, 20);
+ sr->u.request->facetList = facet_list;
if (record_schema)
sr->u.request->recordSchema = record_schema;
if (recordsyntax_size == 1 && !yaz_matchstr(recordsyntax_list[0], "xml"))
if (record_schema)
sr->u.request->recordSchema = record_schema;
if (recordsyntax_size == 1 && !yaz_matchstr(recordsyntax_list[0], "xml"))
@@
-2280,6
+2281,22
@@
static int only_z3950(void)
return 0;
}
return 0;
}
+static int is_SRW(void)
+{
+ if (!conn)
+ {
+ printf("Not connected yet\n");
+ return 1;
+ }
+ if (protocol == PROTO_HTTP && yaz_matchstr(sru_method, "solr"))
+ {
+ printf("Not supported by SRW\n");
+ return 1;
+ }
+ return 0;
+}
+
+
static int cmd_update_common(const char *arg, int version);
static int cmd_update(const char *arg)
static int cmd_update_common(const char *arg, int version);
static int cmd_update(const char *arg)
@@
-2887,6
+2904,8
@@
static int cmd_find(const char *arg)
static int cmd_facets(const char *arg)
{
static int cmd_facets(const char *arg)
{
+ /* TODO Wrong odr. Loosing memory */
+ ODR odr = odr_createmem(ODR_ENCODE);
int size = 0;
if (!*arg)
{
int size = 0;
if (!*arg)
{
@@
-2895,25
+2914,18
@@
static int cmd_facets(const char *arg)
return 0;
}
size = strlen(arg);
return 0;
}
size = strlen(arg);
- if (only_z3950())
- {
- printf("Currently only supported for Z39.50.\n");
- return 0;
+ if (only_z3950() && !yaz_matchstr(sru_method, "solr")) {
+ /* We are not Z39.50 and not SOLR (I think) */
+ printf("WARN: Currently supported for Z39.50 and SOLR.\n");
}
}
- else
- {
- /* TODO Wrong odr. Loosing memory */
- ODR odr = odr_createmem(ODR_ENCODE);
- facet_list = yaz_pqf_parse_facet_list(odr, arg);
+ facet_list = yaz_pqf_parse_facet_list(odr, arg);
- if (!facet_list)
- {
- printf("Invalid facet list: %s", arg);
- return 0;
- }
- return 1;
+ if (!facet_list)
+ {
+ printf("Invalid facet list: %s", arg);
+ return 0;
}
}
- return 2;
+ return 1;
}
}
@@
-4369,7
+4381,7
@@
static void http_response(Z_HTTP_Response *hres)
{
Z_SRW_PDU *sr = 0;
ODR o = odr_createmem(ODR_DECODE);
{
Z_SRW_PDU *sr = 0;
ODR o = odr_createmem(ODR_DECODE);
- ret = yaz_solr_decode(o, hres, &sr);
+ ret = yaz_solr_decode_response(o, hres, &sr);
if (ret == 0 && sr->which == Z_SRW_searchRetrieve_response)
handle_srw_response(sr->u.response);
if (ret == 0 && sr->which == Z_SRW_searchRetrieve_response)
handle_srw_response(sr->u.response);