-/* $Id: zrpn.c,v 1.192 2005-05-24 11:35:42 adam Exp $
+/* $Id: zrpn.c,v 1.194 2005-06-02 11:59:54 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
ZebraSet termset;
};
-static void term_untrans(ZebraHandle zh, int reg_type,
- char *dst, const char *src)
+void zebra_term_untrans(ZebraHandle zh, int reg_type,
+ char *dst, const char *src)
{
int len = 0;
while (*src)
int su_code = 0;
int len = key_SU_decode (&su_code, name);
- term_untrans (p->zh, p->reg_type, term_tmp, name+len+1);
+ zebra_term_untrans (p->zh, p->reg_type, term_tmp, name+len+1);
yaz_log(log_level_rpn, "grep: %d %c %s", su_code, name[len], term_tmp);
zebraExplain_lookup_ord (p->zh->reg->zei,
su_code, &db, &set, &use);
return ZEBRA_OK;
}
-
+/**
+ \brief Create result set(s) for list of terms
+ \param zh Zebra Handle
+ \param termz_org term as used in query but converted to UTF-8
+ \param attributeSet default attribute set
+ \param stream memory for result
+ \param reg_type register type ('w', 'p',..)
+ \param complete_flag whether it's phrases or not
+ \param rank_type term flags for ranking
+ \param xpath_use use attribute for X-Path (-1 for no X-path)
+ \param num_bases number of databases
+ \param basenames array of databases
+ \param rset_mem memory for result sets
+ \param result_sets output result set for each term in list (output)
+ \param number number of output result sets
+ \param kc rset key control to be used for created result sets
+*/
static ZEBRA_RES term_list_trunc(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
const char *termz_org,
if (sort_flag)
return rpn_sort_spec(zh, zapt, attributeSet, stream, sort_sequence,
rank_type, rset_nmem, rset, kc);
+ /* consider if an X-Path query is used */
xpath_len = parse_xpath(zh, zapt, attributeSet, xpath, 10, stream);
if (xpath_len >= 0)
{
- xpath_use = 1016;
- if (xpath[xpath_len-1].part[0] == '@')
- xpath_use = 1015;
- }
-
+ xpath_use = 1016; /* searching for element by default */
+ if (xpath[xpath_len-1].part[0] == '@')
+ xpath_use = 1015; /* last step an attribute .. */
+ }
+
+ /* search using one of the various search type strategies
+ termz is our UTF-8 search term
+ attributeSet is top-level default attribute set
+ stream is ODR for search
+ reg_id is the register type
+ complete_flag is 1 for complete subfield, 0 for incomplete
+ xpath_use is use-attribute to be used for X-Path search, 0 for none
+ */
if (!strcmp(search_type, "phrase"))
{
res = rpn_search_APT_phrase(zh, zapt, termz, attributeSet, stream,
return 0;
}
-static void scan_term_untrans (ZebraHandle zh, NMEM stream, int reg_type,
- char **dst, const char *src)
+void zebra_term_untrans_iconv(ZebraHandle zh, NMEM stream, int reg_type,
+ char **dst, const char *src)
{
char term_src[IT_MAX_WORD];
char term_dst[IT_MAX_WORD];
- term_untrans (zh, reg_type, term_src, src);
+ zebra_term_untrans (zh, reg_type, term_src, src);
if (zh->iconv_from_utf8 != 0)
{
if (lo >= 0)
{
/* get result set for first term */
- scan_term_untrans(zh, stream->mem, reg_id,
- &glist[lo].term, mterm);
+ zebra_term_untrans_iconv(zh, stream->mem, reg_id,
+ &glist[lo].term, mterm);
rset = rset_trunc(zh, &scan_info_array[j0].list[ptr[j0]].isam_p, 1,
glist[lo].term, strlen(glist[lo].term),
NULL, 0, zapt->term->which, rset_nmem,
if (j0 == -1)
break;
- scan_term_untrans (zh, stream->mem, reg_id,
- &glist[lo].term, mterm);
+ zebra_term_untrans_iconv(zh, stream->mem, reg_id,
+ &glist[lo].term, mterm);
rset = rset_trunc
(zh, &scan_info_array[j0].list[before-1-ptr[j0]].isam_p, 1,
glist[lo].term, strlen(glist[lo].term),
- NULL, 0, zapt->term->which,rset_nmem,
+ NULL, 0, zapt->term->which, rset_nmem,
kc, kc->scope);
ptr[j0]++;