X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Ftrunc.c;h=958eb287d6be52038025d266d8a17de064eef806;hb=23b1af194b14847f3ba187e3c5c3015797ad3c4a;hp=ba3f18f50bc6631ddc3f1e557b6eeef3f0e5cce8;hpb=47ea1fc957c7b97bb30a26698f072109cae275e4;p=idzebra-moved-to-github.git diff --git a/index/trunc.c b/index/trunc.c index ba3f18f..958eb28 100644 --- a/index/trunc.c +++ b/index/trunc.c @@ -1,11 +1,26 @@ -/* - * Copyright (C) 1994-2002, Index Data - * All rights reserved. - * Sebastian Hammer, Adam Dickmeiss, Heikki Levanto - * - * $Id: trunc.c,v 1.26 2002-07-25 13:06:43 adam Exp $ - * - */ +/* $Id: trunc.c,v 1.28 2003-03-26 16:41:48 adam Exp $ + Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 + Index Data Aps + +This file is part of the Zebra server. + +Zebra is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Zebra is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +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. +*/ + + #include #include @@ -127,6 +142,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, RSET result; RSFD result_rsfd; rset_temp_parms parms; + int nn = 0; parms.cmp = key_compare_it; parms.key_size = sizeof(struct it_key); @@ -179,6 +195,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, int n = ti->indx[ti->ptr[1]]; rset_write (result, result_rsfd, ti->heap[ti->ptr[1]]); + nn++; while (1) { @@ -224,6 +241,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, int n = ti->indx[ti->ptr[1]]; rset_write (result, result_rsfd, ti->heap[ti->ptr[1]]); + nn++; if (preserve_position) { /* section that preserve all keys */ @@ -279,6 +297,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, int n = ti->indx[ti->ptr[1]]; rset_write (result, result_rsfd, ti->heap[ti->ptr[1]]); + nn++; if (preserve_position) { heap_delete (ti); @@ -335,6 +354,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, int n = ti->indx[ti->ptr[1]]; rset_write (result, result_rsfd, ti->heap[ti->ptr[1]]); + nn++; #if 0 /* section that preserve all keys */ heap_delete (ti); @@ -369,6 +389,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, ISAMS_PP *ispt; int i; struct trunc_info *ti; + int nn = 0; ispt = (ISAMS_PP *) xmalloc (sizeof(*ispt) * (to-from)); @@ -387,6 +408,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, int n = ti->indx[ti->ptr[1]]; rset_write (result, result_rsfd, ti->heap[ti->ptr[1]]); + nn++; while (1) { if (!isams_pp_read (ispt[n], ti->tmpbuf)) @@ -429,6 +451,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, int n = ti->indx[ti->ptr[1]]; rset_write (result, result_rsfd, ti->heap[ti->ptr[1]]); + nn++; if (preserve_position) { @@ -463,6 +486,7 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, else logf (LOG_WARN, "Unknown isam set in rset_trunc_r"); + parms.rset_term->nn = nn; rset_close (result, result_rsfd); return result; }