X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=index%2Fzrpn.c;h=fdb31e9eb8a6c45813ebd893042b6f4eb1f9a04f;hp=280b16754dcf97596c6e06de6a9653b8edc8a9ff;hb=3c5f6226f97612c0d6ac40591f600587c5ffa858;hpb=2d6227440bb26674cab2091b3d79c1934995b762 diff --git a/index/zrpn.c b/index/zrpn.c index 280b167..fdb31e9 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,10 +1,29 @@ /* - * Copyright (C) 1995-1998, Index Data + * Copyright (C) 1995-1999, Index Data * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.85 1998-09-22 10:03:43 adam + * Revision 1.91 1999-02-02 14:51:13 adam + * Updated WIN32 code specific sections. Changed header. + * + * Revision 1.90 1998/11/16 16:03:43 adam + * Moved loggin utilities to Yaz. Was implemented in file zlogs.c. + * + * Revision 1.89 1998/11/16 10:11:55 adam + * Added addtional info for error 114 - unsupported use attribute. + * + * Revision 1.88 1998/10/18 07:54:52 adam + * Additional info added for diagnostics 114 (Unsupported use attribute) and + * 121 (Unsupported attribute set). + * + * Revision 1.87 1998/09/28 11:19:12 adam + * Fix for Compiled ASN.1. + * + * Revision 1.86 1998/09/22 10:48:20 adam + * Minor changes in search API. + * + * Revision 1.85 1998/09/22 10:03:43 adam * Changed result sets to be persistent in the sense that they can * be re-searched if needed. * Fixed memory leak in rsm_or. @@ -300,7 +319,7 @@ */ #include #include -#ifdef WINDOWS +#ifdef WIN32 #include #else #include @@ -914,7 +933,8 @@ static int string_relation (ZebraHandle zh, Z_AttributesPlusTerm *zapt, static int string_term (ZebraHandle zh, Z_AttributesPlusTerm *zapt, const char **term_sub, - oid_value attributeSet, struct grep_info *grep_info, + oid_value attributeSet, NMEM stream, + struct grep_info *grep_info, int reg_type, int complete_flag, int num_bases, char **basenames, char *term_dst) @@ -953,9 +973,25 @@ static int string_term (ZebraHandle zh, Z_AttributesPlusTerm *zapt, logf (LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d", curAttributeSet, use_value, r); if (r == -1) + { + char val_str[32]; + sprintf (val_str, "%d", use_value); zh->errCode = 114; + zh->errString = nmem_strdup (stream, val_str); + } else + { + int oid[OID_SIZE]; + struct oident oident; + + oident.proto = PROTO_Z3950; + oident.oclass = CLASS_ATTSET; + oident.value = curAttributeSet; + oid_ent_to_oid (&oident, oid); + zh->errCode = 121; + zh->errString = nmem_strdup (stream, oident.desc); + } return -1; } if (zebraExplain_curDatabase (zh->zei, basenames[base_no])) @@ -989,7 +1025,10 @@ static int string_term (ZebraHandle zh, Z_AttributesPlusTerm *zapt, } if (!prefix_len) { - zh->errCode = 114; + char val_str[32]; + sprintf (val_str, "%d", use_value); + zh->errCode = 114; + zh->errString = nmem_strdup (stream, val_str); return -1; } term_dict[prefix_len++] = ')'; @@ -1343,6 +1382,7 @@ static RSET rpn_search_APT_phrase (ZebraHandle zh, Z_AttributesPlusTerm *zapt, const char *termz, oid_value attributeSet, + NMEM stream, int reg_type, int complete_flag, const char *rank_type, int num_bases, char **basenames) @@ -1365,7 +1405,7 @@ static RSET rpn_search_APT_phrase (ZebraHandle zh, { logf (LOG_DEBUG, "APT_phrase termp=%s", termp); grep_info.isam_p_indx = 0; - r = string_term (zh, zapt, &termp, attributeSet, &grep_info, + r = string_term (zh, zapt, &termp, attributeSet, stream, &grep_info, reg_type, complete_flag, num_bases, basenames, term_dst); if (r < 1) @@ -1401,6 +1441,7 @@ static RSET rpn_search_APT_or_list (ZebraHandle zh, Z_AttributesPlusTerm *zapt, const char *termz, oid_value attributeSet, + NMEM stream, int reg_type, int complete_flag, const char *rank_type, int num_bases, char **basenames) @@ -1423,7 +1464,7 @@ static RSET rpn_search_APT_or_list (ZebraHandle zh, { logf (LOG_DEBUG, "APT_or_list termp=%s", termp); grep_info.isam_p_indx = 0; - r = string_term (zh, zapt, &termp, attributeSet, &grep_info, + r = string_term (zh, zapt, &termp, attributeSet, stream, &grep_info, reg_type, complete_flag, num_bases, basenames, term_dst); if (r < 1) @@ -1465,6 +1506,7 @@ static RSET rpn_search_APT_and_list (ZebraHandle zh, Z_AttributesPlusTerm *zapt, const char *termz, oid_value attributeSet, + NMEM stream, int reg_type, int complete_flag, const char *rank_type, int num_bases, char **basenames) @@ -1487,7 +1529,7 @@ static RSET rpn_search_APT_and_list (ZebraHandle zh, { logf (LOG_DEBUG, "APT_and_list termp=%s", termp); grep_info.isam_p_indx = 0; - r = string_term (zh, zapt, &termp, attributeSet, &grep_info, + r = string_term (zh, zapt, &termp, attributeSet, stream, &grep_info, reg_type, complete_flag, num_bases, basenames, term_dst); if (r < 1) @@ -1674,6 +1716,7 @@ static RSET rpn_search_APT_numeric (ZebraHandle zh, Z_AttributesPlusTerm *zapt, const char *termz, oid_value attributeSet, + NMEM stream, int reg_type, int complete_flag, const char *rank_type, int num_bases, char **basenames) @@ -1737,6 +1780,7 @@ static RSET rpn_search_APT_numeric (ZebraHandle zh, static RSET rpn_search_APT_local (ZebraHandle zh, Z_AttributesPlusTerm *zapt, const char *termz, oid_value attributeSet, + NMEM stream, const char *rank_type) { RSET result; @@ -1836,7 +1880,12 @@ static RSET rpn_sort_spec (ZebraHandle zh, Z_AttributesPlusTerm *zapt, sks->caseSensitivity = nmem_malloc (stream, sizeof(*sks->caseSensitivity)); *sks->caseSensitivity = 0; +#ifdef ASN_COMPILED + sks->which = Z_SortKeySpec_null; + sks->u.null = odr_nullval (); +#else sks->missingValueAction = 0; +#endif sort_sequence->specs[i] = sks; @@ -1878,30 +1927,30 @@ static RSET rpn_search_APT (ZebraHandle zh, Z_AttributesPlusTerm *zapt, if (!strcmp (search_type, "phrase")) { - return rpn_search_APT_phrase (zh, zapt, termz, attributeSet, + return rpn_search_APT_phrase (zh, zapt, termz, attributeSet, stream, reg_id, complete_flag, rank_type, num_bases, basenames); } else if (!strcmp (search_type, "and-list")) { - return rpn_search_APT_and_list (zh, zapt, termz, attributeSet, + return rpn_search_APT_and_list (zh, zapt, termz, attributeSet, stream, reg_id, complete_flag, rank_type, num_bases, basenames); } else if (!strcmp (search_type, "or-list")) { - return rpn_search_APT_or_list (zh, zapt, termz, attributeSet, + return rpn_search_APT_or_list (zh, zapt, termz, attributeSet, stream, reg_id, complete_flag, rank_type, num_bases, basenames); } else if (!strcmp (search_type, "local")) { - return rpn_search_APT_local (zh, zapt, termz, attributeSet, + return rpn_search_APT_local (zh, zapt, termz, attributeSet, stream, rank_type); } else if (!strcmp (search_type, "numeric")) { - return rpn_search_APT_numeric (zh, zapt, termz, attributeSet, + return rpn_search_APT_numeric (zh, zapt, termz, attributeSet, stream, reg_id, complete_flag, rank_type, num_bases, basenames); } @@ -2037,8 +2086,6 @@ RSET rpn_search (ZebraHandle zh, NMEM nmem, Z_SortKeySpecList *sort_sequence; int sort_status, i; - zlog_rpn (rpn); - zh->errCode = 0; zh->errString = NULL; zh->hits = 0; @@ -2175,7 +2222,6 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, if (attributeset == VAL_NONE) attributeset = VAL_BIB1; - zlog_scan (zapt, attributeset); logf (LOG_DEBUG, "position = %d, num = %d", pos, num); attr_init (&use, zapt, 1);