-/* $Id: extract.c,v 1.224 2006-06-23 11:21:38 adam Exp $
+/* $Id: extract.c,v 1.226 2006-08-15 14:28:33 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
for more details.
You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra. If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
*/
#include <stdio.h>
static void extract_init (struct recExtractCtrl *p, RecWord *w)
{
- w->zebra_maps = p->zebra_maps;
w->seqno = 1;
w->index_name = "any";
w->index_type = 'w';
else
ctrl->seqno[i] = 0;
}
- ctrl->zebra_maps = zh->reg->zebra_maps;
ctrl->flagShowRecords = !zh->m_flag_rw;
}
const char *str, int length)
{
struct it_key key;
-
ZebraHandle zh = p->extractCtrl->handle;
ZebraExplainInfo zei = zh->reg->zei;
int ch;
static void extract_add_sort_string(RecWord *p, const char *str, int length)
{
struct it_key key;
-
ZebraHandle zh = p->extractCtrl->handle;
ZebraExplainInfo zei = zh->reg->zei;
int ch;
static void extract_add_string (RecWord *p, const char *string, int length)
{
+ ZebraHandle zh = p->extractCtrl->handle;
assert (length > 0);
- if (zebra_maps_is_sort (p->zebra_maps, p->index_type))
+ if (zebra_maps_is_sort (zh->reg->zebra_maps, p->index_type))
extract_add_sort_string (p, string, length);
else
{
extract_add_index_string(p, zinfo_index_category_index,
string, length);
- if (zebra_maps_is_alwaysmatches(p->zebra_maps, p->index_type))
+ if (zebra_maps_is_alwaysmatches(zh->reg->zebra_maps, p->index_type))
{
RecWord word;
memcpy(&word, p, sizeof(word));
static void extract_add_incomplete_field (RecWord *p)
{
+ ZebraHandle zh = p->extractCtrl->handle;
const char *b = p->term_buf;
int remain = p->term_len;
const char **map = 0;
if (remain > 0)
- map = zebra_maps_input(p->zebra_maps, p->index_type, &b, remain, 0);
+ map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, 0);
while (map)
{
{
remain = p->term_len - (b - p->term_buf);
if (remain > 0)
- map = zebra_maps_input(p->zebra_maps, p->index_type, &b,
+ map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b,
remain, 0);
else
map = 0;
buf[i++] = *(cp++);
remain = p->term_len - (b - p->term_buf);
if (remain > 0)
- map = zebra_maps_input(p->zebra_maps, p->index_type, &b, remain, 0);
+ map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, 0);
else
map = 0;
}
static void extract_add_complete_field (RecWord *p)
{
+ ZebraHandle zh = p->extractCtrl->handle;
const char *b = p->term_buf;
char buf[IT_MAX_WORD+1];
const char **map = 0;
int i = 0, remain = p->term_len;
if (remain > 0)
- map = zebra_maps_input (p->zebra_maps, p->index_type, &b, remain, 1);
+ map = zebra_maps_input (zh->reg->zebra_maps, p->index_type, &b, remain, 1);
while (remain > 0 && i < IT_MAX_WORD)
{
if (remain > 0)
{
int first = i ? 0 : 1; /* first position */
- map = zebra_maps_input(p->zebra_maps, p->index_type, &b, remain, first);
+ map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, first);
}
else
map = 0;
remain = p->term_len - (b - p->term_buf);
if (remain > 0)
{
- map = zebra_maps_input (p->zebra_maps, p->index_type, &b,
+ map = zebra_maps_input (zh->reg->zebra_maps, p->index_type, &b,
remain, 0);
}
else
static void extract_token_add(RecWord *p)
{
+ ZebraHandle zh = p->extractCtrl->handle;
WRBUF wrbuf;
if (log_level)
yaz_log(log_level, "extract_token_add "
"type=%c index=%s seqno=" ZINT_FORMAT " s=%.*s",
p->index_type, p->index_name,
p->seqno, p->term_len, p->term_buf);
- if ((wrbuf = zebra_replace(p->zebra_maps, p->index_type, 0,
+ if ((wrbuf = zebra_replace(zh->reg->zebra_maps, p->index_type, 0,
p->term_buf, p->term_len)))
{
p->term_buf = wrbuf_buf(wrbuf);
p->term_len = wrbuf_len(wrbuf);
}
- if (zebra_maps_is_complete (p->zebra_maps, p->index_type))
+ if (zebra_maps_is_complete (zh->reg->zebra_maps, p->index_type))
extract_add_complete_field (p);
else
extract_add_incomplete_field(p);