X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=rset%2Frset.c;h=e6cb176e37f2079bf5b274e16b83ed35a03aad9b;hp=b71fe788a5c8ec925f4f3947f20d09a9a3d2c461;hb=89d3a004b7c651fd5673abfc192e1472dc4d4197;hpb=3f385c9ee5fea1f18f200a598747c9b385eee9d8 diff --git a/rset/rset.c b/rset/rset.c index b71fe78..e6cb176 100644 --- a/rset/rset.c +++ b/rset/rset.c @@ -1,5 +1,5 @@ -/* $Id: rset.c,v 1.52 2005-06-22 19:42:39 adam Exp $ - Copyright (C) 1995-2005 +/* $Id: rset.c,v 1.57 2007-01-15 15:10:19 adam Exp $ + Copyright (C) 1995-2007 Index Data ApS This file is part of the Zebra server. @@ -15,9 +15,9 @@ 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. +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #include @@ -175,6 +175,7 @@ RSET rset_create_base(const struct rset_control *sel, rset->hits_limit = 0; rset->hits_round = 1000; rset->keycontrol = kcontrol; + (*kcontrol->inc)(kcontrol); rset->scope = scope; rset->term = term; @@ -243,7 +244,6 @@ RSET rset_dup (RSET rs) (rs->refcount)++; yaz_log(log_level, "rs_dup(%s), rs=%p, refcount=%d", rs->control->desc, rs, rs->refcount); - (*rs->keycontrol->inc)(rs->keycontrol); return rs; } @@ -358,8 +358,17 @@ int rset_default_read(RSFD rfd, void *buf, TERMID *term) int rc = (*rset->control->f_read)(rfd, buf, term); if (rc > 0) { - if (rfd->counted_items == 0 || - (rset->keycontrol->cmp)(buf, rfd->counted_buf) > rset->scope) + int got_scope; + if (rfd->counted_items == 0) + got_scope = rset->scope+1; + else + got_scope = rset->keycontrol->cmp(buf, rfd->counted_buf); + +#if 0 + key_logdump_txt(YLOG_LOG, buf, "rset_default_read"); + yaz_log(YLOG_LOG, "rset_scope=%d got_scope=%d", rset->scope, got_scope); +#endif + if (got_scope > rset->scope) { memcpy(rfd->counted_buf, buf, rset->keycontrol->key_size); rfd->counted_items++; @@ -403,3 +412,11 @@ void rset_visit(RSET rset, int level) rset_visit(rset->children[i], level+1); } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +