dom: accept type="adelete" (accept bad deletes)
[idzebra-moved-to-github.git] / index / index.h
index 7a66bad..2ee8b61 100644 (file)
@@ -1,8 +1,5 @@
-/* $Id: index.h,v 1.193 2007-01-17 13:22:53 adam Exp $
-   Copyright (C) 1995-2007
-   Index Data ApS
-
-This file is part of the Zebra server.
+/* This file is part of the Zebra server.
+   Copyright (C) 2004-2013 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
@@ -29,7 +26,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <idzebra/util.h>
 #include <idzebra/flock.h>
 #include <sortidx.h>
-
 #if HAVE_SYS_TIMES_H
 #include <sys/times.h>
 #endif
@@ -72,7 +68,7 @@ struct dirs_entry {
 };
 
 void getFnameTmp(Res res, char *fname, int no);
-        
+
 struct dirs_info *dirs_open(Dict dict, const char *rep, int rw);
 struct dirs_info *dirs_fopen(Dict dict, const char *path, int rw);
 struct dirs_entry *dirs_read(struct dirs_info *p);
@@ -129,7 +125,7 @@ typedef struct zebra_rank_class {
 
 struct zebra_register {
     char *name;
-    
+
     ISAMS isams;
     ISAMC isamc;
     ISAMB isamb;
@@ -144,7 +140,7 @@ struct zebra_register {
 
     char *server_path_prefix;
     data1_handle dh;
-    ZebraMaps zebra_maps;
+    zebra_maps_t zebra_maps;
     ZebraRankClass rank_classes;
     RecTypes recTypes;
     int seqno;
@@ -202,7 +198,7 @@ struct zebra_session {
     int partial_result;
 #if HAVE_SYS_TIMES_H
     struct tms tms1;
-    struct tms tms2;    
+    struct tms tms2;
 #endif
     int  shadow_enable;
 
@@ -213,6 +209,7 @@ struct zebra_session {
     zint records_updated;
     zint records_deleted;
     zint records_processed;
+    zint records_skipped;
     char *record_encoding;
 
     yaz_iconv_t iconv_to_utf8;
@@ -234,8 +231,8 @@ struct zebra_session {
 
     struct zebra_limit *m_limit;
 
-    int (*busy_handler_func)(void *client_data);
-    void *busy_handler_data;
+    int (*break_handler_func)(void *client_data);
+    void *break_handler_data;
 };
 
 
@@ -260,28 +257,31 @@ void zebra_limit_for_rset(struct zebra_limit *zl,
 struct rset_key_control *zebra_key_control_create(ZebraHandle zh);
 
 ZEBRA_RES rpn_search_top(ZebraHandle zh, Z_RPNStructure *zs,
-                        oid_value attributeSet, 
+                        const Odr_oid *attributeSet, zint hits_limit,
                         NMEM stream, NMEM rset_nmem,
                         Z_SortKeySpecList *sort_sequence,
-                        int num_bases, char **basenames,
+                        int num_bases, const char **basenames,
                         RSET *result_set);
 
 ZEBRA_RES rpn_get_top_approx_limit(ZebraHandle zh, Z_RPNStructure *zs,
                                    zint *approx_limit);
 
 ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
-                   oid_value attributeset,
+                   const Odr_oid *attributeset,
                    int num_bases, char **basenames,
                    int *position, int *num_entries, ZebraScanEntry **list,
-                   int *is_partial, RSET limit_set);
+                   int *is_partial, const char *set_name);
 
 RSET rset_trunc(ZebraHandle zh, ISAM_P *isam_p, int no,
                const char *term, int length_term, const char *flags,
                int preserve_position, int term_type, NMEM rset_nmem,
                struct rset_key_control *kctrl, int scope,
-               struct ord_list *ol, int reg_type,
+               struct ord_list *ol, const char *index_type,
                zint hits_limit, const char *term_ref_id);
 
+ZEBRA_RES resultSetGetBaseNames(ZebraHandle zh, const char *setname,
+                                const char ***basenames, int *num_bases);
+
 void resultSetAddTerm(ZebraHandle zh, ZebraSet s, int reg_type,
                       const char *db, const char *index_name,
                       const char *term);
@@ -306,41 +306,33 @@ ZEBRA_RES resultSetRank(ZebraHandle zh, ZebraSet zebraSet, RSET rset,
                         NMEM nmem);
 void resultSetInvalidate(ZebraHandle zh);
 
-int zebra_record_fetch(ZebraHandle zh, zint sysno, int score, 
-                       zebra_snippets *hit_snippet, ODR stream,
-                       oid_value input_format, Z_RecordComposition *comp,
-                       oid_value *output_format, char **rec_bufp,
-                       int *rec_lenp, char **basenamep,
-                       char **addinfo);
+int zebra_record_fetch(ZebraHandle zh, const char *setname,
+                       zint sysno, int score,
+                       ODR stream,
+                       const Odr_oid *input_format, Z_RecordComposition *comp,
+                       const Odr_oid **output_format, char **rec_bufp,
+                       int *rec_lenp, char **basenamep,
+                       WRBUF addinfo_w);
 
 void extract_get_fname_tmp(ZebraHandle zh, char *fname, int no);
 
+void extract_snippet(ZebraHandle zh, zebra_snippets *sn,
+                     struct ZebraRecStream *stream, RecType rt,
+                     void *recTypeClientData);
+
+int zebra_get_rec_snippets(ZebraHandle zh, zint sysno,
+                           zebra_snippets *snippets);
+
 void zebra_index_merge(ZebraHandle zh);
 
-ZEBRA_RES zebra_buffer_extract_record(ZebraHandle zh, 
+ZEBRA_RES zebra_buffer_extract_record(ZebraHandle zh,
                                       const char *buf, size_t buf_size,
-                                      int delete_flag,
-                                      int test_mode, 
-                                      const char *recordType,
-                                      zint *sysno,
-                                      const char *match_criteria,
-                                      const char *fname,
-                                      int force_update,
-                                      int allow_update);
-
-ZEBRA_RES zebra_extract_record_stream(ZebraHandle zh, 
-                                      struct ZebraRecStream *stream,
-                                      int delete_flag,
-                                      int test_mode, 
+                                      enum zebra_recctrl_action_t action,
                                       const char *recordType,
                                       zint *sysno,
                                       const char *match_criteria,
-                                      const char *fname,
-                                      int force_update,
-                                      int allow_update,
-                                      RecType recType,
-                                      void *recTypeClientData,
-                                      int *more);
+                                      const char *fname);
+
 
 YAZ_EXPORT void zebra_create_stream_mem(struct ZebraRecStream *stream,
                                         const char *buf, size_t sz);
@@ -356,7 +348,7 @@ ZEBRA_RES zebra_snippets_hit_vector(ZebraHandle zh, const char *setname,
 ZEBRA_RES zebra_extract_explain(void *handle, Record rec, data1_node *n);
 
 ZEBRA_RES zebra_extract_file(ZebraHandle zh, zint *sysno, const char *fname,
-                            int deleteFlag);
+                             enum zebra_recctrl_action_t action);
 
 ZEBRA_RES zebra_begin_read(ZebraHandle zh);
 ZEBRA_RES zebra_end_read(ZebraHandle zh);
@@ -370,26 +362,27 @@ Dict dict_open_res(BFiles bfs, const char *name, int cache, int rw,
 void zebra_setError(ZebraHandle zh, int code, const char *addinfo);
 void zebra_setError_zint(ZebraHandle zh, int code, zint i);
 
-void zebra_term_untrans_iconv(ZebraHandle zh, NMEM stream, int reg_type,
-                             char **dst, const char *src);
+int zebra_term_untrans_iconv(ZebraHandle zh, NMEM stream,
+                             const char *index_type,
+                             char **dst, const char *src);
 
 ZEBRA_RES zebra_get_hit_vector(ZebraHandle zh, const char *setname, zint sysno);
 
-void zebra_term_untrans(ZebraHandle zh, int reg_type,
-                       char *dst, const char *src);
+int zebra_term_untrans(ZebraHandle zh, const char *index_type,
+                       char *dst, const char *src);
 
 ZEBRA_RES zebra_apt_get_ord(ZebraHandle zh,
                             Z_AttributesPlusTerm *zapt,
-                            int index_type,
+                            const char *index_type,
                             const char *xpath_use,
-                            oid_value curAttributeSet,
+                            const Odr_oid *curAttributeSet,
                             int *ord);
 
 ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh,
                                   Z_AttributeList *attr_list,
                                   zinfo_index_category_t cat,
-                                  int index_type,
-                                  oid_value curAttributeSet,
+                                  const char *index_type,
+                                  const Odr_oid *curAttributeSet,
                                   int *ord);
 
 ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh,
@@ -398,17 +391,17 @@ ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh,
                              int *numerical);
 
 ZEBRA_RES zebra_update_file_match(ZebraHandle zh, const char *path);
-ZEBRA_RES zebra_update_from_path(ZebraHandle zh, const char *path);
-ZEBRA_RES zebra_delete_from_path(ZebraHandle zh, const char *path);
+ZEBRA_RES zebra_update_from_path(ZebraHandle zh, const char *path,
+                                 enum zebra_recctrl_action_t action);
 ZEBRA_RES zebra_remove_file_match(ZebraHandle zh);
 
 struct rpn_char_map_info
 {
-    ZebraMaps zm;
+    zebra_map_t zm;
     int reg_type;
 };
 
-void rpn_char_map_prepare(struct zebra_register *reg, int reg_type,
+void rpn_char_map_prepare(struct zebra_register *reg, zebra_map_t zm,
                           struct rpn_char_map_info *map_info);
 
 ZEBRA_RES zapt_term_to_utf8(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
@@ -423,12 +416,34 @@ int zebra_check_res(Res res);
 #define FIRST_IN_FIELD_CHAR 1
 #define FIRST_IN_FIELD_LEN 2
 
+ZEBRA_RES zebra_term_limits_APT(ZebraHandle zh,
+                                Z_AttributesPlusTerm *zapt,
+                                zint *hits_limit_value,
+                                const char **term_ref_id_str,
+                                NMEM nmem);
+
+ZEBRA_RES zebra_result_recid_to_sysno(ZebraHandle zh,
+                                      const char *setname,
+                                      zint recid,
+                                      zint *sysnos, int *no_sysnos);
+
+void zebra_count_set(ZebraHandle zh, RSET rset, zint *count,
+                     zint approx_limit);
+
+RSET zebra_create_rset_isam(ZebraHandle zh,
+                            NMEM rset_nmem, struct rset_key_control *kctl,
+                            int scope, ISAM_P pos, TERMID termid);
+
+void zebra_it_key_str_dump(ZebraHandle zh, struct it_key *key,
+                           const char *str, size_t slen, NMEM nmem, int level);
+
 YAZ_END_CDECL
 
 #endif
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab