- if (res != ZEBRA_OK)
- return res;
- if (!*term_sub) /* no more terms ? */
- return res;
- yaz_log(log_level_rpn, "term: %s", term_dst);
- *rset = rset_trunc(zh, grep_info->isam_p_buf,
- grep_info->isam_p_indx, term_dst,
- strlen(term_dst), rank_type, 1 /* preserve pos */,
- zapt->term->which, rset_nmem,
- kc, kc->scope, ol, index_type, hits_limit_value,
- term_ref_id_str);
- if (!*rset)
- return ZEBRA_FAIL;
- return ZEBRA_OK;
+ if (res == ZEBRA_OK && *term_sub)
+ {
+ yaz_log(log_level_rpn, "term: %s", wrbuf_cstr(display_term));
+ *rset = rset_trunc(zh, grep_info->isam_p_buf,
+ grep_info->isam_p_indx, wrbuf_buf(display_term),
+ wrbuf_len(display_term), rank_type,
+ 1 /* preserve pos */,
+ zapt->term->which, rset_nmem,
+ kc, kc->scope, ol, index_type, hits_limit_value,
+ term_ref_id_str);
+ if (!*rset)
+ res = ZEBRA_FAIL;
+ }
+ wrbuf_destroy(display_term);
+ return res;