1 /* $Id: zebraapi.h,v 1.20 2002-09-03 11:44:54 adam 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);
129 YAZ_EXPORT void zebra_admin_import_segment (ZebraHandle zh,
132 void zebra_admin_import_end (ZebraHandle zh);
134 void zebra_begin_trans (ZebraHandle zh);
135 void zebra_end_trans (ZebraHandle zh);
137 int zebra_commit (ZebraHandle zh);
139 int zebra_init (ZebraHandle zh);
140 int zebra_compact (ZebraHandle zh);
141 void zebra_repository_update (ZebraHandle zh);
142 void zebra_repository_delete (ZebraHandle zh);
143 void zebra_repository_show (ZebraHandle zh);
144 int zebra_record_insert (ZebraHandle zh, const char *buf, int len);
146 YAZ_EXPORT void zebra_set_group (ZebraHandle zh, struct recordGroup *rg);
148 YAZ_EXPORT void zebra_result (ZebraHandle zh, int *code, char **addinfo);
151 YAZ_EXPORT int zebra_resultSetTerms (ZebraHandle zh, const char *setname,
153 int *type, char *out, size_t *len);
155 YAZ_EXPORT void zebra_sort (ZebraHandle zh, ODR stream,
156 int num_input_setnames,
157 const char **input_setnames,
158 const char *output_setname,
159 Z_SortKeySpecList *sort_sequence,
164 int zebra_select_databases (ZebraHandle zh, int num_bases,
165 const char **basenames);
168 int zebra_select_database (ZebraHandle zh, const char *basename);
171 void zebra_shadow_enable (ZebraHandle zh, int value);
174 void zebra_register_statistics (ZebraHandle zh, int dumpdict);
177 int zebra_record_encoding (ZebraHandle zh, const char *encoding);