-/* $Id: alvis.c,v 1.8 2005-08-24 08:30:37 adam Exp $
+/* $Id: alvis.c,v 1.12 2006-05-23 15:21:58 marc Exp $
Copyright (C) 1995-2005
Index Data ApS
const char *stylesheet;
struct filter_schema *next;
const char *default_schema;
+ /* char default_schema; */
const char *include_snippet;
xsltStylesheetPtr stylesheet_xsp;
};
schema->stylesheet_xsp =
xsltParseStylesheetFile(
(const xmlChar*) schema->stylesheet);
+
+
}
else if (!XML_STRCMP(ptr->name, "split"))
{
struct filter_schema *schema;
for (schema = tinfo->schemas; schema; schema = schema->next)
{
- if (est)
+ /* find requested schema */
+ if (est)
{
if (schema->identifier && !strcmp(schema->identifier, est))
return schema;
if (schema->name && !strcmp(schema->name, est))
return schema;
}
+
+ /* or return default schema if defined */
if (schema->default_schema)
return schema;
}
+
+ /* return first schema if no default schema defined */
+ if (tinfo->schemas)
+ return tinfo->schemas;
+
return 0;
}
-static void filter_config(void *clientData, Res res, const char *args)
+static ZEBRA_RES filter_config(void *clientData, Res res, const char *args)
{
struct filter_info *tinfo = clientData;
if (!args || !*args)
- args = "xsltfilter.xml";
+ return ZEBRA_FAIL;
if (tinfo->fname && !strcmp(args, tinfo->fname))
- return;
+ return ZEBRA_OK;
destroy_schemas(tinfo);
create_schemas(tinfo, args);
+ return ZEBRA_OK;
}
static void filter_destroy(void *clientData)
static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
{
- const char *esn = zebra_xslt_ns;
- const char *params[20];
+ /* const char *esn = zebra_xslt_ns; */
+ const char *esn = 0;
+ const char *params[32];
struct filter_info *tinfo = clientData;
xmlDocPtr resDoc;
xmlDocPtr doc;
window_size = atoi(schema->include_snippet);
params[0] = 0;
- set_param_str(params, "schema", esn, p->odr);
+ set_param_int(params, "id", p->localno, p->odr);
if (p->fname)
set_param_str(params, "filename", p->fname, p->odr);
+ if (p->staticrank >= 0)
+ set_param_int(params, "rank", p->staticrank, p->odr);
+ if (esn)
+ set_param_str(params, "schema", esn, p->odr);
+ else
+ set_param_str(params, "schema", "", p->odr);
+ /* should use default elem set here .. */
if (p->score >= 0)
set_param_int(params, "score", p->score, p->odr);
set_param_int(params, "size", p->recordSize, p->odr);
- set_param_int(params, "id", p->localno, p->odr);
if (window_size >= 0)
set_param_xml(params, "snippet", snippet_doc(p, 1, window_size),
&filter_type,
0,
};
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+