2 * Copyright (C) 1994-2002, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: zebraapi.h,v 1.16 2002-04-26 08:44:47 adam Exp $
14 #include <yaz/proto.h>
33 /* Retrieval Record Descriptor */
35 int errCode; /* non-zero if error when fetching this */
36 char *errString; /* error string */
37 int position; /* position of record in result set (1,2,..) */
38 char *buf; /* record buffer (void pointer really) */
40 oid_value format; /* record syntax */
42 } ZebraRetrievalRecord;
44 /* Scan Term Descriptor */
46 int occurrences; /* scan term occurrences */
47 char *term; /* scan term string */
50 typedef struct zebra_session *ZebraHandle;
51 typedef struct zebra_service *ZebraService;
53 /* Open Zebra using file 'configName' (usually zebra.cfg) */
54 YAZ_EXPORT ZebraHandle zebra_open (ZebraService zs);
56 /* Search using RPN-Query */
57 YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR input, ODR output,
59 const char *setname, int *hits);
61 /* Retrieve record(s) */
62 YAZ_EXPORT void zebra_records_retrieve (ZebraHandle zh, ODR stream,
63 const char *setname, Z_RecordComposition *comp,
64 oid_value input_format,
65 int num_recs, ZebraRetrievalRecord *recs);
68 YAZ_EXPORT void zebra_scan (ZebraHandle zh, ODR stream,
69 Z_AttributesPlusTerm *zapt,
70 oid_value attributeset,
71 int *position, int *num_entries,
72 ZebraScanEntry **list,
75 /* Delete Result Set(s) */
76 YAZ_EXPORT int zebra_deleleResultSet(ZebraHandle zh, int function,
77 int num_setnames, char **setnames,
80 /* Close zebra and destroy handle */
81 YAZ_EXPORT void zebra_close (ZebraHandle zh);
84 YAZ_EXPORT int zebra_errCode (ZebraHandle zh);
85 /* string representatio of above */
86 YAZ_EXPORT const char *zebra_errString (ZebraHandle zh);
88 /* extra information associated with error */
89 YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh);
91 /* do authentication */
92 YAZ_EXPORT int zebra_auth (ZebraHandle zh, const char *user, const char *pass);
94 /* Character normalisation on specific register .
95 This routine is subject to change - do not use. */
96 YAZ_EXPORT int zebra_string_norm (ZebraHandle zh, unsigned reg_id,
97 const char *input_str, int input_len,
98 char *output_str, int output_len);
100 YAZ_EXPORT void zebra_admin_create (ZebraHandle zh, const char *db);
102 YAZ_EXPORT ZebraService zebra_start (const char *configName);
103 YAZ_EXPORT void zebra_stop (ZebraService zs);
105 YAZ_EXPORT void zebra_admin_shutdown (ZebraHandle zh);
106 YAZ_EXPORT void zebra_admin_start (ZebraHandle zh);
108 YAZ_EXPORT void zebra_shutdown (ZebraService zs);
110 YAZ_EXPORT void zebra_admin_import_begin (ZebraHandle zh, const char *database);
112 YAZ_EXPORT void zebra_admin_import_segment (ZebraHandle zh,
115 void zebra_admin_import_end (ZebraHandle zh);
117 void zebra_begin_trans (ZebraHandle zh);
118 void zebra_end_trans (ZebraHandle zh);
120 int zebra_commit (ZebraHandle zh);
122 int zebra_init (ZebraHandle zh);
123 int zebra_compact (ZebraHandle zh);
124 void zebra_repository_update (ZebraHandle zh);
125 void zebra_repository_delete (ZebraHandle zh);
126 void zebra_repository_show (ZebraHandle zh);
127 int zebra_record_insert (ZebraHandle zh, const char *buf, int len);
129 YAZ_EXPORT void zebra_set_group (ZebraHandle zh, struct recordGroup *rg);
131 YAZ_EXPORT void zebra_result (ZebraHandle zh, int *code, char **addinfo);
133 YAZ_EXPORT const char *zebra_resultSetTerms (ZebraHandle zh,
135 int no, int *count, int *no_max);
137 YAZ_EXPORT void zebra_sort (ZebraHandle zh, ODR stream,
138 int num_input_setnames,
139 const char **input_setnames,
140 const char *output_setname,
141 Z_SortKeySpecList *sort_sequence,
146 int zebra_select_databases (ZebraHandle zh, int num_bases,
147 const char **basenames);
150 int zebra_select_database (ZebraHandle zh, const char *basename);
153 void zebra_shadow_enable (ZebraHandle zh, int value);
156 void zebra_register_statistics (ZebraHandle zh);