X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fretrieve.c;h=64c3dcc1dbeed2f23af6fd06604b482d4c6d92f9;hb=b3af54f7bf58db2a5d85b6a54b720bf6c5359c1f;hp=bd60ebe4ec5f3aef50544d50e4ac978ef581d4bf;hpb=60cf55c8e68e07456299c4500e945f04eef9aa6b;p=idzebra-moved-to-github.git diff --git a/index/retrieve.c b/index/retrieve.c index bd60ebe..64c3dcc 100644 --- a/index/retrieve.c +++ b/index/retrieve.c @@ -1,4 +1,4 @@ -/* $Id: retrieve.c,v 1.51 2006-11-16 10:49:11 adam Exp $ +/* $Id: retrieve.c,v 1.55 2006-11-21 22:17:49 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -109,7 +109,7 @@ static void parse_zebra_elem(const char *elem, } -int zebra_special_index_fetch(ZebraHandle zh, SYSNO sysno, ODR odr, +int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr, Record rec, const char *elemsetname, oid_value input_format, @@ -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, "\n"); } - *rec_lenp = wrbuf_len(wrbuf); *rec_bufp = odr_malloc(odr, *rec_lenp); memcpy(*rec_bufp, wrbuf_buf(wrbuf), *rec_lenp); @@ -251,13 +253,16 @@ int zebra_special_index_fetch(ZebraHandle zh, SYSNO sysno, ODR odr, } -int zebra_special_fetch(ZebraHandle zh, SYSNO sysno, ODR odr, +int zebra_special_fetch(ZebraHandle zh, zint sysno, ODR odr, const char *elemsetname, oid_value input_format, oid_value *output_format, 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 @@ -316,7 +321,7 @@ int zebra_special_fetch(ZebraHandle zh, SYSNO sysno, ODR odr, struct ZebraRecStream stream; RecordAttr *recordAttr = rec_init_attr(zh->reg->zei, rec); zebra_create_record_stream(zh, &rec, &stream); - *output_format = VAL_SUTRS; + *output_format = input_format; *rec_lenp = recordAttr->recordSize; *rec_bufp = (char *) odr_malloc(odr, *rec_lenp); stream.readf(&stream, *rec_bufp, *rec_lenp); @@ -331,7 +336,7 @@ int zebra_special_fetch(ZebraHandle zh, SYSNO sysno, ODR odr, } -int zebra_record_fetch(ZebraHandle zh, SYSNO sysno, int score, +int zebra_record_fetch(ZebraHandle zh, zint sysno, int score, zebra_snippets *hit_snippet, ODR odr, oid_value input_format, Z_RecordComposition *comp, oid_value *output_format, @@ -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);