1 /* $Id: zebraapi.h,v 1.22 2002-10-22 09:37:56 heikki Exp $
2 Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
30 #include <yaz/proto.h>
50 /* Retrieval Record Descriptor */
52 int errCode; /* non-zero if error when fetching this */
53 char *errString; /* error string */
54 int position; /* position of record in result set (1,2,..) */
55 char *buf; /* record buffer (void pointer really) */
57 oid_value format; /* record syntax */
59 } ZebraRetrievalRecord;
61 /* Scan Term Descriptor */
63 int occurrences; /* scan term occurrences */
64 char *term; /* scan term string */
67 typedef struct zebra_session *ZebraHandle;
68 typedef struct zebra_service *ZebraService;
70 /* Open Zebra using file 'configName' (usually zebra.cfg) */
71 YAZ_EXPORT ZebraHandle zebra_open (ZebraService zs);
73 /* Search using RPN-Query */
74 YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR input, ODR output,
76 const char *setname, int *hits);
78 /* Retrieve record(s) */
79 YAZ_EXPORT void zebra_records_retrieve (ZebraHandle zh, ODR stream,
80 const char *setname, Z_RecordComposition *comp,
81 oid_value input_format,
82 int num_recs, ZebraRetrievalRecord *recs);
85 YAZ_EXPORT void zebra_scan (ZebraHandle zh, ODR stream,
86 Z_AttributesPlusTerm *zapt,
87 oid_value attributeset,
88 int *position, int *num_entries,
89 ZebraScanEntry **list,
92 /* Delete Result Set(s) */
93 YAZ_EXPORT int zebra_deleleResultSet(ZebraHandle zh, int function,
94 int num_setnames, char **setnames,
97 /* Close zebra and destroy handle */
98 YAZ_EXPORT void zebra_close (ZebraHandle zh);
100 /* last error code */
101 YAZ_EXPORT int zebra_errCode (ZebraHandle zh);
102 /* string representatio of above */
103 YAZ_EXPORT const char *zebra_errString (ZebraHandle zh);
105 /* extra information associated with error */
106 YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh);
108 /* do authentication */
109 YAZ_EXPORT int zebra_auth (ZebraHandle zh, const char *user, const char *pass);
111 /* Character normalisation on specific register .
112 This routine is subject to change - do not use. */
113 YAZ_EXPORT int zebra_string_norm (ZebraHandle zh, unsigned reg_id,
114 const char *input_str, int input_len,
115 char *output_str, int output_len);
117 YAZ_EXPORT void zebra_admin_create (ZebraHandle zh, const char *db);
119 YAZ_EXPORT ZebraService zebra_start (const char *configName);
120 YAZ_EXPORT void zebra_stop (ZebraService zs);
122 YAZ_EXPORT void zebra_admin_shutdown (ZebraHandle zh);
123 YAZ_EXPORT void zebra_admin_start (ZebraHandle zh);
125 YAZ_EXPORT void zebra_shutdown (ZebraService zs);
127 YAZ_EXPORT void zebra_admin_import_begin (ZebraHandle zh, const char *database,
128 const char *record_type);
130 YAZ_EXPORT void zebra_admin_import_segment (ZebraHandle zh,
133 void zebra_admin_import_end (ZebraHandle zh);
135 int zebra_admin_exchange_record (ZebraHandle zh,
136 const char *database,
139 const char *recid_buf, size_t recid_len,
142 void zebra_begin_trans (ZebraHandle zh);
143 void zebra_end_trans (ZebraHandle zh);
145 int zebra_commit (ZebraHandle zh);
147 int zebra_init (ZebraHandle zh);
148 int zebra_compact (ZebraHandle zh);
149 void zebra_repository_update (ZebraHandle zh);
150 void zebra_repository_delete (ZebraHandle zh);
151 void zebra_repository_show (ZebraHandle zh);
152 int zebra_record_insert (ZebraHandle zh, const char *buf, int len);
154 YAZ_EXPORT void zebra_set_group (ZebraHandle zh, struct recordGroup *rg);
156 YAZ_EXPORT void zebra_result (ZebraHandle zh, int *code, char **addinfo);
159 YAZ_EXPORT int zebra_resultSetTerms (ZebraHandle zh, const char *setname,
161 int *type, char *out, size_t *len);
163 YAZ_EXPORT void zebra_sort (ZebraHandle zh, ODR stream,
164 int num_input_setnames,
165 const char **input_setnames,
166 const char *output_setname,
167 Z_SortKeySpecList *sort_sequence,
172 int zebra_select_databases (ZebraHandle zh, int num_bases,
173 const char **basenames);
176 int zebra_select_database (ZebraHandle zh, const char *basename);
179 void zebra_shadow_enable (ZebraHandle zh, int value);
182 void zebra_register_statistics (ZebraHandle zh, int dumpdict);
185 int zebra_record_encoding (ZebraHandle zh, const char *encoding);
189 void zebra_set_resource(ZebraHandle zh, const char *name, const char *value);
191 const char *zebra_get_resource(ZebraHandle zh,
192 const char *name, const char *defaultvalue);