X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Falvis.c;h=0822faba44331a1446d4ff2f3d7b915ef5b4b3c3;hb=4df7866a571bf540cb320b62e6eec6f7e81b65dd;hp=851064fdbb723b26569ffbf629862397afd6946f;hpb=fd10c2116175815cf6c2da430a439c27991e1918;p=idzebra-moved-to-github.git diff --git a/index/alvis.c b/index/alvis.c index 851064f..0822fab 100644 --- a/index/alvis.c +++ b/index/alvis.c @@ -1,5 +1,5 @@ -/* $Id: alvis.c,v 1.9 2006-12-22 12:13:40 adam Exp $ - Copyright (C) 1995-2006 +/* $Id: alvis.c,v 1.17 2007-04-16 21:54:37 adam Exp $ + Copyright (C) 1995-2007 Index Data ApS This file is part of the Zebra server. @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include +#include #include #include @@ -345,6 +346,7 @@ static void filter_destroy(void *clientData) { struct filter_info *tinfo = clientData; destroy_schemas(tinfo); + xfree(tinfo->full_name); if (tinfo->reader) xmlFreeTextReader(tinfo->reader); odr_destroy(tinfo->odr); @@ -434,13 +436,7 @@ static void index_record(struct filter_info *tinfo,struct recExtractCtrl *ctrl, sscanf(id_str, "%255s", ctrl->match_criteria); if (rank_str) - ctrl->staticrank = -#if HAVE_ATOLL - atoll(rank_str); -#else - atoi(rank_str); -#endif - + ctrl->staticrank = atozint(rank_str); ptr = ptr->children; } @@ -513,7 +509,9 @@ static int extract_split(struct filter_info *tinfo, struct recExtractCtrl *p) p /* I/O handler */, 0 /* URL */, 0 /* encoding */, - XML_PARSE_XINCLUDE); + XML_PARSE_XINCLUDE + | XML_PARSE_NOENT + | XML_PARSE_NONET); } if (!tinfo->reader) return RECCTRL_EXTRACT_ERROR_GENERIC; @@ -556,11 +554,17 @@ static int extract_full(struct filter_info *tinfo, struct recExtractCtrl *p) xmlDocPtr doc = xmlReadIO(ioread_ex, ioclose_ex, p /* I/O handler */, 0 /* URL */, 0 /* encoding */, - XML_PARSE_XINCLUDE); + XML_PARSE_XINCLUDE + | XML_PARSE_NOENT + | XML_PARSE_NONET); if (!doc) - { return RECCTRL_EXTRACT_ERROR_GENERIC; - } + /* else { + xmlNodePtr root = xmlDocGetRootElement(doc); + if (!root) + return RECCTRL_EXTRACT_ERROR_GENERIC; + } */ + return extract_doc(tinfo, p, doc); } else @@ -629,10 +633,10 @@ static const char *snippet_doc(struct recRetrieveCtrl *p, int text_mode, else wrbuf_printf(wrbuf, "\n"); - xml_doc_str = odr_strdup(p->odr, wrbuf_buf(wrbuf)); + xml_doc_str = odr_strdup(p->odr, wrbuf_cstr(wrbuf)); zebra_snippets_destroy(res); - wrbuf_free(wrbuf, 1); + wrbuf_destroy(wrbuf); return xml_doc_str; } @@ -700,7 +704,7 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) doc = xmlReadIO(ioread_ret, ioclose_ret, p /* I/O handler */, 0 /* URL */, 0 /* encoding */, - XML_PARSE_XINCLUDE); + XML_PARSE_XINCLUDE | XML_PARSE_NOENT | XML_PARSE_NONET); if (!doc) { p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS; @@ -726,7 +730,8 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) { p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS; } - else if (p->input_format == VAL_NONE || p->input_format == VAL_TEXT_XML) + else if (!p->input_format + || !oid_oidcmp(p->input_format, yaz_oid_recsyn_xml)) { xmlChar *buf_out; int len_out; @@ -737,13 +742,13 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) else xmlDocDumpMemory(resDoc, &buf_out, &len_out); - p->output_format = VAL_TEXT_XML; + p->output_format = yaz_oid_recsyn_xml; p->rec_len = len_out; p->rec_buf = odr_malloc(p->odr, p->rec_len); memcpy(p->rec_buf, buf_out, p->rec_len); xmlFree(buf_out); } - else if (p->output_format == VAL_SUTRS) + else if (!oid_oidcmp(p->output_format, yaz_oid_recsyn_sutrs)) { xmlChar *buf_out; int len_out; @@ -754,7 +759,7 @@ static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p) else xmlDocDumpMemory(resDoc, &buf_out, &len_out); - p->output_format = VAL_SUTRS; + p->output_format = yaz_oid_recsyn_sutrs; p->rec_len = len_out; p->rec_buf = odr_malloc(p->odr, p->rec_len); memcpy(p->rec_buf, buf_out, p->rec_len);