X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=recctrl%2Frectext.c;h=48460d5a6302b237ded7d6b64c534460c3dd3fd3;hb=deff57cfa9d9b39c4a4f1c9b82a64c6e61d821a4;hp=5d04bfb7ecf6e21a2a09ab1d4a3825022c5376f0;hpb=c5f0a119be3ef4af84d7c7f5c028418cc8073d8a;p=idzebra-moved-to-github.git diff --git a/recctrl/rectext.c b/recctrl/rectext.c index 5d04bfb..48460d5 100644 --- a/recctrl/rectext.c +++ b/recctrl/rectext.c @@ -1,6 +1,6 @@ -/* $Id: rectext.c,v 1.17 2004-05-14 10:57:42 adam Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 - Index Data Aps +/* $Id: rectext.c,v 1.25 2005-03-30 09:25:24 adam Exp $ + Copyright (C) 1995-2005 + Index Data ApS This file is part of the Zebra server. @@ -25,20 +25,25 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include -#include "rectext.h" +#include +#include struct text_info { char *sep; }; -static void *text_init (RecType recType) +static void *text_init (Res res, RecType recType) { struct text_info *tinfo = (struct text_info *) xmalloc(sizeof(*tinfo)); tinfo->sep = 0; return tinfo; } +static void text_config(void *clientData, Res res, const char *args) +{ + +} + static void text_destroy (void *clientData) { struct text_info *tinfo = clientData; @@ -100,15 +105,11 @@ static int text_extract (void *clientData, struct recExtractCtrl *p) struct buf_info *fi = buf_open (p); #if 0 - yaz_log(LOG_LOG, "text_extract off=%ld", + yaz_log(YLOG_LOG, "text_extract off=%ld", (long) (*fi->p->tellf)(fi->p->fh)); #endif xfree(tinfo->sep); tinfo->sep = 0; - if (p->subType) { - if (!strncmp(p->subType, "sep=", 4)) - tinfo->sep = xstrdup(p->subType+4); - } (*p->init)(p, &recWord); recWord.reg_type = 'w'; do @@ -123,8 +124,8 @@ static int text_extract (void *clientData, struct recExtractCtrl *p) } if (i) { - recWord.string = w; - recWord.length = i; + recWord.term_buf = w; + recWord.term_len = i; (*p->tokenAdd)(&recWord); } } while (r > 0); @@ -134,7 +135,6 @@ static int text_extract (void *clientData, struct recExtractCtrl *p) static int text_retrieve (void *clientData, struct recRetrieveCtrl *p) { - struct text_info *tinfo = clientData; int r, text_ptr = 0; static char *text_buf = NULL; static int text_size = 0; @@ -184,7 +184,8 @@ static int text_retrieve (void *clientData, struct recRetrieveCtrl *p) sprintf (text_buf, "Rank: %d\n", p->score); text_ptr = strlen(text_buf); } - sprintf (text_buf + text_ptr, "Local Number: %d\n", p->localno); + sprintf (text_buf + text_ptr, "Local Number: " ZINT_FORMAT "\n", + p->localno); text_ptr = strlen(text_buf); if (p->fname) { @@ -230,9 +231,20 @@ static int text_retrieve (void *clientData, struct recRetrieveCtrl *p) static struct recType text_type = { "text", text_init, + text_config, text_destroy, text_extract, text_retrieve }; -RecType recTypeText = &text_type; +RecType +#ifdef IDZEBRA_STATIC_TEXT +idzebra_filter_text +#else +idzebra_filter +#endif + +[] = { + &text_type, + 0, +};