More work on multi-map for sort
[idzebra-moved-to-github.git] / include / sortidx.h
index 31d210b..5800382 100644 (file)
@@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <yaz/yconfig.h>
 #include <idzebra/version.h>
 #include <idzebra/bfile.h>
+#include <yaz/wrbuf.h>
 
 YAZ_BEGIN_CDECL
 
@@ -35,7 +36,12 @@ typedef struct zebra_sort_index *zebra_sort_index_t;
 
 #define ZEBRA_SORT_TYPE_FLAT 1
 #define ZEBRA_SORT_TYPE_ISAMB 2
+#define ZEBRA_SORT_TYPE_MULTI 3
 
+struct zebra_sort_ent {
+    int num;
+    WRBUF wrbuf;
+};
 
 /** \brief creates sort handle
     \param bfs block files handle
@@ -71,6 +77,15 @@ void zebra_sort_sysno(zebra_sort_index_t si, zint sysno);
 void zebra_sort_add(zebra_sort_index_t si, const char *buf, int len);
 
 
+/** \brief adds multi-map content to sort file
+    \param si sort index handle
+    \param ent multi-map value
+
+    zebra_sort_type and zebra_sort_sysno must be called prior to this
+*/
+void zebra_sort_add_ent(zebra_sort_index_t si, struct zebra_sort_ent *ent);
+
+
 /** \brief delete sort entry
     \param si sort index handle
 
@@ -84,7 +99,7 @@ void zebra_sort_delete(zebra_sort_index_t si);
     \retval 0 could not be read
     \retval 1 could be read (found)
 */
-int zebra_sort_read(zebra_sort_index_t si, char *buf);
+int zebra_sort_read(zebra_sort_index_t si, WRBUF w);
 
 YAZ_END_CDECL