+#if YAZ_HAVE_XML2
+static zoom_ret ZOOM_connection_srw_send_scan(ZOOM_connection c)
+{
+ ZOOM_scanset scan;
+ Z_SRW_PDU *sr = 0;
+ const char *option_val = 0;
+
+ if (!c->tasks)
+ return zoom_complete;
+ assert (c->tasks->which == ZOOM_TASK_SCAN);
+ scan = c->tasks->u.scan.scan;
+
+ sr = yaz_srw_get(c->odr_out, Z_SRW_scan_request);
+
+ /* SRU scan can only carry CQL and PQF */
+ if (scan->query->z_query->which == Z_Query_type_104)
+ {
+ sr->u.scan_request->query_type = Z_SRW_query_type_cql;
+ sr->u.scan_request->scanClause.cql = scan->query->query_string;
+ }
+ else if (scan->query->z_query->which == Z_Query_type_1
+ || scan->query->z_query->which == Z_Query_type_101)
+ {
+ sr->u.scan_request->query_type = Z_SRW_query_type_pqf;
+ sr->u.scan_request->scanClause.pqf = scan->query->query_string;
+ }
+ else
+ {
+ set_ZOOM_error(c, ZOOM_ERROR_UNSUPPORTED_QUERY, 0);
+ return zoom_complete;
+ }
+
+ sr->u.scan_request->maximumTerms = odr_intdup(
+ c->odr_out, ZOOM_options_get_int(scan->options, "number", 10));
+
+ sr->u.scan_request->responsePosition = odr_intdup(
+ c->odr_out, ZOOM_options_get_int(scan->options, "position", 1));
+
+ option_val = ZOOM_options_get(scan->options, "extraArgs");
+ if (option_val)
+ sr->extra_args = odr_strdup(c->odr_out, option_val);
+ return send_srw(c, sr);
+}
+#else
+static zoom_ret ZOOM_connection_srw_send_scan(ZOOM_connection c)
+{
+ return zoom_complete;
+}
+#endif
+
+