1 /* $Id: zebraapi.h,v 1.19 2002-08-02 19:26:56 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>
49 /* Retrieval Record Descriptor */
51 int errCode; /* non-zero if error when fetching this */
52 char *errString; /* error string */
53 int position; /* position of record in result set (1,2,..) */
54 char *buf; /* record buffer (void pointer really) */
56 oid_value format; /* record syntax */
58 } ZebraRetrievalRecord;
60 /* Scan Term Descriptor */
62 int occurrences; /* scan term occurrences */
63 char *term; /* scan term string */
66 typedef struct zebra_session *ZebraHandle;
67 typedef struct zebra_service *ZebraService;
69 /* Open Zebra using file 'configName' (usually zebra.cfg) */
70 YAZ_EXPORT ZebraHandle zebra_open (ZebraService zs);
72 /* Search using RPN-Query */
73 YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR input, ODR output,
75 const char *setname, int *hits);
77 /* Retrieve record(s) */
78 YAZ_EXPORT void zebra_records_retrieve (ZebraHandle zh, ODR stream,
79 const char *setname, Z_RecordComposition *comp,
80 oid_value input_format,
81 int num_recs, ZebraRetrievalRecord *recs);
84 YAZ_EXPORT void zebra_scan (ZebraHandle zh, ODR stream,
85 Z_AttributesPlusTerm *zapt,
86 oid_value attributeset,
87 int *position, int *num_entries,
88 ZebraScanEntry **list,
91 /* Delete Result Set(s) */
92 YAZ_EXPORT int zebra_deleleResultSet(ZebraHandle zh, int function,
93 int num_setnames, char **setnames,
96 /* Close zebra and destroy handle */
97 YAZ_EXPORT void zebra_close (ZebraHandle zh);
100 YAZ_EXPORT int zebra_errCode (ZebraHandle zh);
101 /* string representatio of above */
102 YAZ_EXPORT const char *zebra_errString (ZebraHandle zh);
104 /* extra information associated with error */
105 YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh);
107 /* do authentication */
108 YAZ_EXPORT int zebra_auth (ZebraHandle zh, const char *user, const char *pass);
110 /* Character normalisation on specific register .
111 This routine is subject to change - do not use. */
112 YAZ_EXPORT int zebra_string_norm (ZebraHandle zh, unsigned reg_id,
113 const char *input_str, int input_len,
114 char *output_str, int output_len);
116 YAZ_EXPORT void zebra_admin_create (ZebraHandle zh, const char *db);
118 YAZ_EXPORT ZebraService zebra_start (const char *configName);
119 YAZ_EXPORT void zebra_stop (ZebraService zs);
121 YAZ_EXPORT void zebra_admin_shutdown (ZebraHandle zh);
122 YAZ_EXPORT void zebra_admin_start (ZebraHandle zh);
124 YAZ_EXPORT void zebra_shutdown (ZebraService zs);
126 YAZ_EXPORT void zebra_admin_import_begin (ZebraHandle zh, const char *database);
128 YAZ_EXPORT void zebra_admin_import_segment (ZebraHandle zh,
131 void zebra_admin_import_end (ZebraHandle zh);
133 void zebra_begin_trans (ZebraHandle zh);
134 void zebra_end_trans (ZebraHandle zh);
136 int zebra_commit (ZebraHandle zh);
138 int zebra_init (ZebraHandle zh);
139 int zebra_compact (ZebraHandle zh);
140 void zebra_repository_update (ZebraHandle zh);
141 void zebra_repository_delete (ZebraHandle zh);
142 void zebra_repository_show (ZebraHandle zh);
143 int zebra_record_insert (ZebraHandle zh, const char *buf, int len);
145 YAZ_EXPORT void zebra_set_group (ZebraHandle zh, struct recordGroup *rg);
147 YAZ_EXPORT void zebra_result (ZebraHandle zh, int *code, char **addinfo);
150 YAZ_EXPORT int zebra_resultSetTerms (ZebraHandle zh, const char *setname,
152 int *type, char *out, size_t *len);
154 YAZ_EXPORT void zebra_sort (ZebraHandle zh, ODR stream,
155 int num_input_setnames,
156 const char **input_setnames,
157 const char *output_setname,
158 Z_SortKeySpecList *sort_sequence,
163 int zebra_select_databases (ZebraHandle zh, int num_bases,
164 const char **basenames);
167 int zebra_select_database (ZebraHandle zh, const char *basename);
170 void zebra_shadow_enable (ZebraHandle zh, int value);
173 void zebra_register_statistics (ZebraHandle zh, int dumpdict);
176 int zebra_record_encoding (ZebraHandle zh, const char *encoding);