X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fsortidx.c;h=36bf914056b70da18de7865333fafbcd87357877;hb=de044fbb534d2db022ca965d0328dac7a6edf032;hp=3f5776e031046538aac6d005b319b11f3806fe56;hpb=a66b7d79383ae700f3358731eecfe2aafed0e90d;p=idzebra-moved-to-github.git diff --git a/index/sortidx.c b/index/sortidx.c index 3f5776e..36bf914 100644 --- a/index/sortidx.c +++ b/index/sortidx.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1994-2010 Index Data + Copyright (C) 1994-2011 Index Data 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 @@ -18,7 +18,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#if HAVE_CONFIG_H +#include +#endif +#include #include #include @@ -155,7 +158,7 @@ static int sort_term_code_read(void *vp, char **dst, int *insertMode) return 0; (s->no)--; - + *insertMode = s->insert_flag; memcpy(*dst, &s->st, sizeof(s->st)); *dst += sizeof(s->st); @@ -279,7 +282,7 @@ int zebra_sort_type(zebra_sort_index_t si, int id) case ZEBRA_SORT_TYPE_ISAMB: method.codec.encode = sort_term_encode1; method.codec.decode = sort_term_decode1; - + sprintf(fname, "sortb%d", id); sf->u.isamb = isamb_open2(si->bfs, fname, si->write_flag, &method, /* cache */ 0, @@ -299,7 +302,7 @@ int zebra_sort_type(zebra_sort_index_t si, int id) isam_block_size = 32768; method.codec.encode = sort_term_encode2; method.codec.decode = sort_term_decode2; - + sprintf(fname, "sortm%d", id); sf->u.isamb = isamb_open2(si->bfs, fname, si->write_flag, &method, /* cache */ 0, @@ -373,12 +376,12 @@ void zebra_sort_delete(zebra_sort_index_t si, zint section_id) s.st.section_id = section_id; s.st.length = 0; s.st.term[0] = '\0'; - + s.no = 1; s.insert_flag = 0; isamc_i.clientData = &s; isamc_i.read_item = sort_term_code_read; - + isamb_merge(sf->u.isamb, &sf->isam_p, &isamc_i); sf->no_deleted++; } @@ -400,7 +403,7 @@ void zebra_sort_add(zebra_sort_index_t si, zint section_id, WRBUF wrbuf) len = strlen(wrbuf_buf(wrbuf)); if (len > SORT_IDX_ENTRYSIZE) len = SORT_IDX_ENTRYSIZE; - + memcpy(si->entry_buf, wrbuf_buf(wrbuf), len); if (len < SORT_IDX_ENTRYSIZE-len) memset(si->entry_buf+len, 0, SORT_IDX_ENTRYSIZE-len); @@ -429,7 +432,7 @@ void zebra_sort_add(zebra_sort_index_t si, zint section_id, WRBUF wrbuf) s.insert_flag = 1; isamc_i.clientData = &s; isamc_i.read_item = sort_term_code_read; - + isamb_merge(sf->u.isamb, &sf->isam_p, &isamc_i); sf->no_inserted++; } @@ -454,7 +457,7 @@ void zebra_sort_add(zebra_sort_index_t si, zint section_id, WRBUF wrbuf) s.insert_flag = 1; isamc_i.clientData = &s; isamc_i.read_item = sort_term_code_read; - + isamb_merge(sf->u.isamb, &sf->isam_p, &isamc_i); sf->no_inserted++; }