+ switch (term->which)
+ {
+ case Z_Term_general:
+ ZOOM_options_setl(opt, name,
+ (const char *)(term->u.general->buf),
+ term->u.general->len);
+ break;
+ case Z_Term_characterString:
+ ZOOM_options_set(opt, name, term->u.characterString);
+ break;
+ case Z_Term_numeric:
+ ZOOM_options_set_int(opt, name, *term->u.numeric);
+ break;
+ }
+}
+
+static void handle_queryExpression(ZOOM_options opt, const char *name,
+ Z_QueryExpression *exp)
+{
+ char opt_name[80];
+
+ switch (exp->which)
+ {
+ case Z_QueryExpression_term:
+ if (exp->u.term && exp->u.term->queryTerm)
+ {
+ sprintf(opt_name, "%s.term", name);
+ handle_queryExpressionTerm(opt, opt_name, exp->u.term->queryTerm);
+ }
+ break;
+ case Z_QueryExpression_query:
+ break;
+ }
+}
+
+static void handle_searchResult(ZOOM_connection c, ZOOM_resultset resultset,
+ Z_OtherInformation *o)
+{
+ int i;
+ for (i = 0; o && i < o->num_elements; i++)
+ {
+ if (o->list[i]->which == Z_OtherInfo_externallyDefinedInfo)
+ {
+ Z_External *ext = o->list[i]->information.externallyDefinedInfo;
+
+ if (ext->which == Z_External_searchResult1)
+ {
+ int j;
+ Z_SearchInfoReport *sr = ext->u.searchResult1;
+
+ if (sr->num)
+ ZOOM_options_set_int(
+ resultset->options, "searchresult.size", sr->num);
+
+ for (j = 0; j < sr->num; j++)
+ {
+ Z_SearchInfoReport_s *ent =
+ ext->u.searchResult1->elements[j];
+ char pref[80];
+
+ sprintf(pref, "searchresult.%d", j);
+
+ if (ent->subqueryId)
+ {
+ char opt_name[80];
+ sprintf(opt_name, "%s.id", pref);
+ ZOOM_options_set(resultset->options, opt_name,
+ ent->subqueryId);
+ }
+ if (ent->subqueryExpression)
+ {
+ char opt_name[80];
+ sprintf(opt_name, "%s.subquery", pref);
+ handle_queryExpression(resultset->options, opt_name,
+ ent->subqueryExpression);
+ }
+ if (ent->subqueryInterpretation)
+ {
+ char opt_name[80];
+ sprintf(opt_name, "%s.interpretation", pref);
+ handle_queryExpression(resultset->options, opt_name,
+ ent->subqueryInterpretation);
+ }
+ if (ent->subqueryRecommendation)
+ {
+ char opt_name[80];
+ sprintf(opt_name, "%s.recommendation", pref);
+ handle_queryExpression(resultset->options, opt_name,
+ ent->subqueryRecommendation);
+ }
+ if (ent->subqueryCount)
+ {
+ char opt_name[80];
+ sprintf(opt_name, "%s.count", pref);
+ ZOOM_options_set_int(resultset->options, opt_name,
+ *ent->subqueryCount);
+ }
+ }
+ }
+ }
+ }