+Zebra reads (non-standard) attribute 10 for RPN queries. The value, when
+specified, is returned as subqueryId in SearchResult-1. It un-specified
+no subqueryId is part of SearchResult-1.
+
Added 'dbperms' setting to zebra.cfg. Names file with lines of
format username: db1+...dbn, listing databases that user has access to.
Database-specific access control only happens for searching, at present.
-/* $Id: zrpn.c,v 1.205 2005-08-26 10:13:31 adam Exp $
+/* $Id: zrpn.c,v 1.206 2005-11-02 11:43:26 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
}
static int attr_find_ex(AttrType *src, oid_value *attributeSetP,
- const char **string_value)
+ const char **string_value)
{
int num_attributes;
static ZEBRA_RES term_limits_APT(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
zint *hits_limit_value,
- const char **term_ref_id_str)
+ const char **term_ref_id_str,
+ NMEM nmem)
{
AttrType term_ref_id_attr;
AttrType hits_limit_attr;
+ int term_ref_id_int;
attr_init(&hits_limit_attr, zapt, 9);
*hits_limit_value = attr_find(&hits_limit_attr, NULL);
attr_init(&term_ref_id_attr, zapt, 10);
- attr_find_ex(&term_ref_id_attr, NULL, term_ref_id_str);
+ term_ref_id_int = attr_find_ex(&term_ref_id_attr, NULL, term_ref_id_str);
+ if (term_ref_id_int != -1)
+ {
+ char *res = nmem_malloc(nmem, 20);
+ sprintf(res, "%d", term_ref_id_int);
+ *term_ref_id_str = res;
+ }
/* no limit given ? */
if (*hits_limit_value == -1)
+ {
if (*term_ref_id_str)
{
/* use global if term_ref is present */
/* no counting if term_ref is not present */
*hits_limit_value = 0;
}
+ }
else if (*hits_limit_value == 0)
{
/* 0 is the same as global limit */
const char *term_ref_id_str = 0;
*rset = 0;
- term_limits_APT(zh, zapt, &hits_limit_value, &term_ref_id_str);
+ term_limits_APT(zh, zapt, &hits_limit_value, &term_ref_id_str,
+ stream);
grep_info->isam_p_indx = 0;
res = string_term(zh, zapt, term_sub, attributeSet, stream, grep_info,
reg_type, complete_flag, num_bases, basenames,
zint hits_limit_value;
const char *term_ref_id_str = 0;
- term_limits_APT(zh, zapt, &hits_limit_value, &term_ref_id_str);
+ term_limits_APT(zh, zapt, &hits_limit_value, &term_ref_id_str, stream);
yaz_log(log_level_rpn, "APT_numeric t='%s'", termz);
if (grep_info_prepare(zh, zapt, &grep_info, reg_type) == ZEBRA_FAIL)
-/* $Id: zserver.c,v 1.140 2005-09-13 11:51:06 adam Exp $
+/* $Id: zserver.c,v 1.141 2005-11-02 11:43:26 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
sizeof(*sr->elements));
for (i = 0; i<no_terms; i++)
{
+ Z_SearchInfoReport_s *se;
Z_Term *term;
zint count;
int approx;
char outbuf[1024];
size_t len = sizeof(outbuf);
+ const char *term_ref_id = 0;
zebra_result_set_term_info(zh, r->setname, i,
&count, &approx, outbuf, &len,
- 0 /* term_ref_id */ );
-
- sr->elements[i] = odr_malloc (r->stream, sizeof(**sr->elements));
- sr->elements[i]->subqueryId = 0;
- sr->elements[i]->fullQuery = odr_malloc (r->stream,
- sizeof(bool_t));
- *sr->elements[i]->fullQuery = 0;
- sr->elements[i]->subqueryExpression =
+ &term_ref_id);
+ se = sr->elements[i] = odr_malloc (r->stream, sizeof(**sr->elements));
+ se->subqueryId = term_ref_id ?
+ odr_strdup(r->stream, term_ref_id) : 0;
+
+ se->fullQuery = odr_intdup(r->stream, 0);
+ se->subqueryExpression =
odr_malloc (r->stream, sizeof(Z_QueryExpression));
- sr->elements[i]->subqueryExpression->which =
+ se->subqueryExpression->which =
Z_QueryExpression_term;
- sr->elements[i]->subqueryExpression->u.term =
+ se->subqueryExpression->u.term =
odr_malloc (r->stream, sizeof(Z_QueryExpressionTerm));
term = odr_malloc (r->stream, sizeof(Z_Term));
- sr->elements[i]->subqueryExpression->u.term->queryTerm = term;
+ se->subqueryExpression->u.term->queryTerm = term;
switch (type)
{
case Z_Term_characterString:
- yaz_log (YLOG_DEBUG, "term as characterString");
term->which = Z_Term_characterString;
term->u.characterString = odr_strdup (r->stream, outbuf);
break;
case Z_Term_general:
- yaz_log (YLOG_DEBUG, "term as general");
term->which = Z_Term_general;
term->u.general = odr_malloc (r->stream, sizeof(*term->u.general));
term->u.general->size = term->u.general->len = len;
term->which = Z_Term_general;
term->u.null = odr_nullval();
}
- sr->elements[i]->subqueryExpression->u.term->termComment = 0;
- sr->elements[i]->subqueryInterpretation = 0;
- sr->elements[i]->subqueryRecommendation = 0;
+ se->subqueryExpression->u.term->termComment = 0;
+ se->subqueryInterpretation = 0;
+ se->subqueryRecommendation = 0;
if (count > 2000000000)
count = 2000000000;
- sr->elements[i]->subqueryCount = odr_intdup (r->stream, (int) count);
- sr->elements[i]->subqueryWeight = 0;
- sr->elements[i]->resultsByDB = 0;
+ se->subqueryCount = odr_intdup(r->stream, (int) count);
+ se->subqueryWeight = 0;
+ se->resultsByDB = 0;
}
}