Contact address for Zebra is zebra-help@indexdata.dk
[idzebra-moved-to-github.git] / index / retrieve.c
index eebc808..cffbc40 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: retrieve.c,v 1.52 2006-11-16 11:10:46 adam Exp $
+/* $Id: retrieve.c,v 1.54 2006-11-17 08:20:17 marc Exp $
    Copyright (C) 1995-2006
    Index Data ApS
 
@@ -123,6 +123,9 @@ int zebra_special_index_fetch(ZebraHandle zh, SYSNO sysno, ODR odr,
     WRBUF wrbuf = 0;
     zebra_rec_keys_t keys;
     
+    /* set output variables before processing possible error states */
+    /* *rec_lenp = 0; */
+
     /* only accept XML and SUTRS requests */
     if (input_format != VAL_TEXT_XML
         && input_format != VAL_SUTRS){
@@ -241,7 +244,6 @@ int zebra_special_index_fetch(ZebraHandle zh, SYSNO sysno, ODR odr,
         if (input_format == VAL_TEXT_XML)
             wrbuf_printf(wrbuf, "</record>\n");
      }
-    
     *rec_lenp = wrbuf_len(wrbuf);
     *rec_bufp = odr_malloc(odr, *rec_lenp);
     memcpy(*rec_bufp, wrbuf_buf(wrbuf), *rec_lenp);
@@ -258,6 +260,9 @@ int zebra_special_fetch(ZebraHandle zh, SYSNO sysno, ODR odr,
                            char **rec_bufp, int *rec_lenp)
 {
     Record rec;
+    
+    /* set output variables before processing possible error states */
+    /* *rec_lenp = 0; */
 
     /* only accept XML and SUTRS requests */
     if (input_format != VAL_TEXT_XML
@@ -351,7 +356,6 @@ int zebra_record_fetch(ZebraHandle zh, SYSNO sysno, int score,
     elemsetname = yaz_get_esn(comp);
 
     /* processing zebra special elementset names of form 'zebra:: */
-    /* SUGGESTION: do not check elemset nema here, buuuut ... */  
     if (elemsetname && 0 == strncmp(elemsetname, "zebra::", 7))
         return  zebra_special_fetch(zh, sysno, odr,
                                     elemsetname + 7,
@@ -431,10 +435,6 @@ int zebra_record_fetch(ZebraHandle zh, SYSNO sysno, int score,
        zebra_snippets_log(snippet, YLOG_LOG);
 #endif
 
-        /* SUGGESTION: do not check elemset name here, buuuut ... 
-           add another recType Struct with zebra internal stuff here,
-           which overrides the Alvis/GRS-1/Safari filters .... 
-        */
         if (!(rt = recType_byName(zh->reg->recTypes, zh->res,
                                   file_type, &clientData)))
         {
@@ -442,14 +442,6 @@ int zebra_record_fetch(ZebraHandle zh, SYSNO sysno, int score,
         }
         else
         {
-        /* SUGGESTION: do not check elemset name here, buuuut ... 
-           add another recType Struct with zebra internal stuff here,
-           which overrides the Alvis/GRS-1/Safari filters .... 
-           (*rt->retrieve) method to make the correct encoded, etc, retrieval,
-           where all needed info already is found in the   &retrieveCtr
-           parameter. This way, we do not need to re-code/dublicate a lot of 
-           logic. 
-        */
             (*rt->retrieve)(clientData, &retrieveCtrl);
             return_code = retrieveCtrl.diagnostic;
 
@@ -458,10 +450,6 @@ int zebra_record_fetch(ZebraHandle zh, SYSNO sysno, int score,
             *rec_lenp = retrieveCtrl.rec_len;
             *addinfo = retrieveCtrl.addinfo;
         }
-        /* another SUGGESTION: throw out all this snippet stuff in this 
-           file, and do it correctly - either inside filters, or in another 
-           new   (*rt->retrieve)(clientData, &retrieveCtrl); type 'snippet'
-        */
 
        zebra_snippets_destroy(snippet);
         zebra_snippets_destroy(retrieveCtrl.doc_snippet);