X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=index%2Fsortidx.c;h=5490139e492c91ff0f0592988ee8f0b56376e541;hb=b9217c7876c7102f82a7c6547bc1858ed3b39979;hp=a5d5c7b0aa79526da76d06679bdd39361a59c351;hpb=af102b1fb451ba27bfa7343528c4240b3ab3a80b;p=idzebra-moved-to-github.git diff --git a/index/sortidx.c b/index/sortidx.c index a5d5c7b..5490139 100644 --- a/index/sortidx.c +++ b/index/sortidx.c @@ -315,25 +315,26 @@ int zebra_sort_type(zebra_sort_index_t si, int id) return 0; } +static void zebra_sortf_rewind(struct sortFile *sf) +{ + if (sf->isam_pp) + isamb_pp_close(sf->isam_pp); + sf->isam_pp = 0; + sf->no_inserted = 0; + sf->no_deleted = 0; +} + void zebra_sort_sysno(zebra_sort_index_t si, zint sysno) { - struct sortFile *sf = si->current_file; zint new_sysno = rec_sysno_to_int(sysno); + struct sortFile *sf; for (sf = si->files; sf; sf = sf->next) { if (sf->no_inserted || sf->no_deleted) - { - isamb_pp_close(sf->isam_pp); - sf->isam_pp = 0; - } - else if (sf->isam_pp && new_sysno < si->sysno && sf->isam_pp) - { - isamb_pp_close(sf->isam_pp); - sf->isam_pp = 0; - } - sf->no_inserted = 0; - sf->no_deleted = 0; + zebra_sortf_rewind(sf); + else if (sf->isam_pp && new_sysno <= si->sysno) + zebra_sortf_rewind(sf); } si->sysno = new_sysno; }