X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzrpn.c;h=fb9ad2e5a1167620429d3ac6a14c16b4c7b92b41;hb=2c7c2ca460fee75f3bebc0479b9787f0c401db03;hp=5b50a4f217aac5e5b9f3bd3b36afbc89b0a7fe08;hpb=2038fcec0ea77e3fdb854ff968423d3ef24d53a8;p=idzebra-moved-to-github.git diff --git a/index/zrpn.c b/index/zrpn.c index 5b50a4f..fb9ad2e 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.28 1995-10-13 12:26:43 adam + * Revision 1.29 1995-10-13 16:01:49 adam + * Work on relations. + * + * Revision 1.28 1995/10/13 12:26:43 adam * Optimization of truncation. * * Revision 1.27 1995/10/12 17:07:22 adam @@ -496,17 +499,60 @@ static int grep_handle (Dict_char *name, const char *info, void *p) return 0; } +static void gen_regular_ge (char *dst, int val) +{ + int dst_p = 0; + int w = 1; + int d; + int pos = 0; + int i; + + if (val < 0) + val = 0; + while ((d=(val % (w*10))/w)) + { + sprintf (dst + dst_p, "%d", val); + + dst_p = strlen(dst) - pos - 1; + + dst[dst_p++] = '['; + dst[dst_p++] = d +'1'; + dst[dst_p++] = '-'; + dst[dst_p++] = '9'; + dst[dst_p++] = ']'; + + for (i = 0; ierrCode = 114; return -1; } - + switch (relation_value) + { + case 1: + case 2: + break; + case 4: + logf (LOG_LOG, "Relation ge"); + gen_regular_ge (term_dict + strlen(term_dict), atoi(term_sub)); + logf (LOG_LOG, "dict_lookup_grep: %s", term_dict); + dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info, grep_handle); + logf (LOG_LOG, "%d positions", grep_info->isam_p_indx); + return 0; + case 5: + logf (LOG_LOG, "Relation gt"); + gen_regular_ge (term_dict + strlen(term_dict), atoi(term_sub)+1); + logf (LOG_LOG, "dict_lookup_grep: %s", term_dict); + dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info, grep_handle); + logf (LOG_LOG, "%d positions", grep_info->isam_p_indx); + return 0; + } switch (truncation_value) { case -1: /* not specified */ @@ -562,7 +630,7 @@ static int trunc_term (ZServerInfo *zi, Z_AttributesPlusTerm *zapt, dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info, grep_handle); break; } - logf (LOG_DEBUG, "%d positions", grep_info->isam_p_indx); + logf (LOG_LOG, "%d positions", grep_info->isam_p_indx); return 0; } @@ -851,7 +919,6 @@ static RSET rpn_search_APT_local (ZServerInfo *zi, Z_AttributesPlusTerm *zapt, return result; } - static RSET rpn_search_APT (ZServerInfo *zi, Z_AttributesPlusTerm *zapt, oid_value attributeSet) {