IDZEBRA
2.2.7
|
Zebra API. More...
#include <yaz/odr.h>
#include <yaz/proto.h>
#include <idzebra/res.h>
#include <idzebra/version.h>
#include <idzebra/recctrl.h>
Go to the source code of this file.
Data Structures | |
struct | ZebraTransactionStatus |
struct | ZebraRetrievalRecord |
struct | ZebraScanEntry |
struct | ZebraMetaRecord |
Typedefs | |
typedef struct zebra_session * | ZebraHandle |
a Zebra Handle - (session) More... | |
typedef struct zebra_service * | ZebraService |
a Zebra Service handle More... | |
Functions | |
ZebraService | zebra_start (const char *configName) ZEBRA_GCC_ATTR((warn_unused_result)) |
Creates a Zebra Service. More... | |
ZebraService | zebra_start_res (const char *configName, Res def_res, Res over_res) ZEBRA_GCC_ATTR((warn_unused_result)) |
Creates a Zebra service with resources. More... | |
ZEBRA_RES | zebra_stop (ZebraService zs) |
stops a Zebra service. More... | |
void | zebra_filter_info (ZebraService zs, void *cd, void(*cb)(void *cd, const char *name)) |
Lists enabled Zebra filters. More... | |
ZebraHandle | zebra_open (ZebraService zs, Res res) ZEBRA_GCC_ATTR((warn_unused_result)) |
Creates a Zebra session handle within service. More... | |
ZEBRA_RES | zebra_close (ZebraHandle zh) |
Destroys Zebra session handle. More... | |
int | zebra_errCode (ZebraHandle zh) |
Returns error code for last error. More... | |
const char * | zebra_errString (ZebraHandle zh) |
Returns error string for last error. More... | |
char * | zebra_errAdd (ZebraHandle zh) |
Returns additional info for last error. More... | |
void | zebra_result (ZebraHandle zh, int *code, char **addinfo) |
Returns error code and additional info for last error. More... | |
const char * | zebra_get_encoding (ZebraHandle zh) |
Returns character set encoding for session. More... | |
ZEBRA_RES | zebra_set_approx_limit (ZebraHandle zh, zint approx_limit) |
Set limit before Zebra does approx hit count. More... | |
ZEBRA_RES | zebra_search_PQF (ZebraHandle zh, const char *pqf_query, const char *setname, zint *hits) |
Search using PQF Query String. More... | |
ZEBRA_RES | zebra_search_RPN_x (ZebraHandle zh, ODR o, Z_RPNQuery *query, const char *setname, zint *hits, int *estimated_hit_count, int *partial_resultset) |
Search using RPN Query structure (from ASN.1) More... | |
ZEBRA_RES | zebra_search_RPN (ZebraHandle zh, ODR o, Z_RPNQuery *query, const char *setname, zint *hits) |
Search using RPN Query structure (from ASN.1) More... | |
ZEBRA_RES | zebra_records_retrieve (ZebraHandle zh, ODR stream, const char *setname, Z_RecordComposition *comp, const Odr_oid *input_format, int num_recs, ZebraRetrievalRecord *recs) |
Retrieve records from result set (after search) More... | |
int | zebra_deleteResultSet (ZebraHandle zh, int function, int num_setnames, char **setnames, int *statuses) |
Deletes one or more resultsets. More... | |
ZEBRA_RES | zebra_result_set_term_no (ZebraHandle zh, const char *setname, int *num_terms) |
returns number of term info terms assocaited with result set More... | |
ZEBRA_RES | zebra_result_set_term_info (ZebraHandle zh, const char *setname, int no, zint *count, int *approx, char *termbuf, size_t *termlen, const char **term_ref_id) |
returns information about a term assocated with a result set More... | |
ZEBRA_RES | zebra_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, const Odr_oid *attributeset, int *position, int *num_entries, ZebraScanEntry **entries, int *is_partial, const char *setname) |
performs Scan (Z39.50 style) More... | |
ZEBRA_RES | zebra_scan_PQF (ZebraHandle zh, ODR stream, const char *query, int *position, int *num_entries, ZebraScanEntry **entries, int *is_partial, const char *setname) |
performs Scan (taking PQF string) More... | |
ZEBRA_RES | zebra_auth (ZebraHandle zh, const char *user, const char *pass) |
authenticate user. Returns 0 if OK, != 0 on failure More... | |
int | zebra_string_norm (ZebraHandle zh, const char *index_type, const char *input_str, int input_len, char *output_str, int output_len) |
Normalize zebra term for register (subject to change!) More... | |
ZEBRA_RES | zebra_create_database (ZebraHandle zh, const char *db) |
Creates a database. More... | |
ZEBRA_RES | zebra_drop_database (ZebraHandle zh, const char *db) |
Deletes a database (drop) More... | |
ZEBRA_RES | zebra_admin_shutdown (ZebraHandle zh) |
ZEBRA_RES | zebra_admin_start (ZebraHandle zh) |
ZEBRA_RES | zebra_shutdown (ZebraService zs) |
ZEBRA_RES | zebra_admin_import_begin (ZebraHandle zh, const char *database, const char *record_type) |
ZEBRA_RES | zebra_admin_import_segment (ZebraHandle zh, Z_Segment *segment) |
ZEBRA_RES | zebra_admin_import_end (ZebraHandle zh) |
ZEBRA_RES | zebra_begin_trans (ZebraHandle zh, int rw) ZEBRA_GCC_ATTR((warn_unused_result)) |
ZEBRA_RES | zebra_end_trans (ZebraHandle zh) ZEBRA_GCC_ATTR((warn_unused_result)) |
ZEBRA_RES | zebra_end_transaction (ZebraHandle zh, ZebraTransactionStatus *stat) |
ZEBRA_RES | zebra_commit (ZebraHandle zh) |
ZEBRA_RES | zebra_clean (ZebraHandle zh) |
ZEBRA_RES | zebra_init (ZebraHandle zh) |
ZEBRA_RES | zebra_compact (ZebraHandle zh) |
ZEBRA_RES | zebra_repository_index (ZebraHandle zh, const char *path, enum zebra_recctrl_action_t action) |
ZEBRA_RES | zebra_repository_update (ZebraHandle zh, const char *path) |
ZEBRA_RES | zebra_repository_delete (ZebraHandle zh, const char *path) |
ZEBRA_RES | zebra_repository_show (ZebraHandle zh, const char *path) |
ZEBRA_RES | zebra_add_record (ZebraHandle zh, const char *buf, int buf_size) |
Simple update record. More... | |
ZEBRA_RES | zebra_update_record (ZebraHandle zh, enum zebra_recctrl_action_t action, const char *recordType, zint *sysno, const char *match, const char *fname, const char *buf, int buf_size) |
Updates record. More... | |
ZEBRA_RES | zebra_sort (ZebraHandle zh, ODR stream, int num_input_setnames, const char **input_setnames, const char *output_setname, Z_SortKeySpecList *sort_sequence, int *sort_status) ZEBRA_GCC_ATTR((warn_unused_result)) |
ZEBRA_RES | zebra_select_databases (ZebraHandle zh, int num_bases, const char **basenames) ZEBRA_GCC_ATTR((warn_unused_result)) |
ZEBRA_RES | zebra_select_database (ZebraHandle zh, const char *basename) ZEBRA_GCC_ATTR((warn_unused_result)) |
void | zebra_shadow_enable (ZebraHandle zh, int value) |
int | zebra_register_statistics (ZebraHandle zh, int dumpdict) |
ZEBRA_RES | zebra_record_encoding (ZebraHandle zh, const char *encoding) |
ZEBRA_RES | zebra_octet_term_encoding (ZebraHandle zh, const char *encoding) |
void | zebra_set_resource (ZebraHandle zh, const char *name, const char *value) |
const char * | zebra_get_resource (ZebraHandle zh, const char *name, const char *defaultvalue) |
void | zebra_pidfname (ZebraService zs, char *path) |
ZebraMetaRecord * | zebra_meta_records_create (ZebraHandle zh, const char *name, int num, zint *positions) |
ZebraMetaRecord * | zebra_meta_records_create_range (ZebraHandle zh, const char *name, zint start, int num) |
void | zebra_meta_records_destroy (ZebraHandle zh, ZebraMetaRecord *records, int num) |
struct BFiles_struct * | zebra_get_bfs (ZebraHandle zh) |
ZEBRA_RES | zebra_set_limit (ZebraHandle zh, int complement_flag, zint *ids) |
ZEBRA_RES | zebra_set_break_handler (ZebraHandle zh, int(*f)(void *client_data), void *client_data) |
ZEBRA_RES | zebra_register_check (ZebraHandle zh, const char *spec) |
Zebra API.
Return codes: Most functions has return type ZEBRA_RES, where ZEBRA_FAIL indicates failure; ZEBRA_OK indicates success.
Definition in file api.h.
ZEBRA_RES zebra_add_record | ( | ZebraHandle | zh, |
const char * | buf, | ||
int | buf_size | ||
) |
Simple update record.
zh | session handle |
buf | record buffer |
buf_size | record buffer size |
This function is a simple wrapper or zebra_update_record with action=action_update (insert or replace) .
Definition at line 2600 of file zebraapi.c.
References action_update, and zebra_update_record().
ZEBRA_RES zebra_admin_import_begin | ( | ZebraHandle | zh, |
const char * | database, | ||
const char * | record_type | ||
) |
Definition at line 1404 of file zebraapi.c.
References log_level, zebra_begin_trans(), ZEBRA_FAIL, zebra_select_database(), and map_baseinfo::zh.
Referenced by es_admin_request().
ZEBRA_RES zebra_admin_import_end | ( | ZebraHandle | zh | ) |
Definition at line 1414 of file zebraapi.c.
References log_level, ZEBRA_CHECK_HANDLE, zebra_end_trans(), and map_baseinfo::zh.
Referenced by bend_segment().
ZEBRA_RES zebra_admin_import_segment | ( | ZebraHandle | zh, |
Z_Segment * | segment | ||
) |
Definition at line 1421 of file zebraapi.c.
References action_update, log_level, ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, ZEBRA_OK, zebra_update_record(), and map_baseinfo::zh.
Referenced by bend_segment().
ZEBRA_RES zebra_admin_shutdown | ( | ZebraHandle | zh | ) |
Definition at line 570 of file zebraapi.c.
References log_level, zebra_session::service, zebra_service::session_lock, zebra_service::stop_flag, ZEBRA_CHECK_HANDLE, zebra_mutex_cond_lock(), zebra_mutex_cond_unlock(), and ZEBRA_OK.
Referenced by es_admin_request().
ZEBRA_RES zebra_admin_start | ( | ZebraHandle | zh | ) |
Definition at line 581 of file zebraapi.c.
References log_level, zebra_session::service, zebra_service::session_lock, ZEBRA_CHECK_HANDLE, zebra_mutex_cond_lock(), zebra_mutex_cond_unlock(), and ZEBRA_OK.
Referenced by es_admin_request().
ZEBRA_RES zebra_auth | ( | ZebraHandle | zh, |
const char * | user, | ||
const char * | pass | ||
) |
authenticate user. Returns 0 if OK, != 0 on failure
zh | session handle |
user | user name |
pass | password |
Definition at line 1372 of file zebraapi.c.
References zebra_service::dbaccess, zebra_session::dbaccesslist, zebra_service::global_res, zebra_service::passwd_db, passwd_db_auth(), res_get(), zebra_session::service, zebra_session::user_perm, ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, ZEBRA_OK, and map_baseinfo::zh.
Referenced by bend_init().
ZEBRA_RES zebra_begin_trans | ( | ZebraHandle | zh, |
int | rw | ||
) |
Definition at line 1710 of file zebraapi.c.
References ASSERTZHRES, zebra_session::basenames, zebra_session::errCode, zebra_session::errString, zebra_register::last_val, zebra_session::lock_normal, zebra_session::lock_shadow, log_level, zebra_session::path_reg, read_res_for_transaction(), zebra_session::records_deleted, zebra_session::records_inserted, zebra_session::records_processed, zebra_session::records_skipped, zebra_session::records_updated, zebra_session::reg, zebra_session::reg_name, zebra_session::res, res_get(), resultSetInvalidate(), zebra_register::seqno, zebra_session::service, zebra_session::shadow_enable, zebra_session::trans_no, zebra_session::trans_w_no, zebra_session::user_perm, ZEBRA_CHECK_HANDLE, zebra_commit(), ZEBRA_FAIL, zebra_flush_reg(), zebra_get_state(), zebra_lock_r(), zebra_lock_w(), ZEBRA_OK, zebra_register_close(), zebra_register_open(), zebra_select_default_database(), zebra_set_state(), zebra_setError(), zebra_unlock(), zebraExplain_curDatabase(), and zebra_register::zei.
Referenced by bend_esrequest(), main(), zebra_admin_import_begin(), zebra_begin_read(), zebra_create_database(), zebra_drop_database(), and zebra_update_record().
ZEBRA_RES zebra_clean | ( | ZebraHandle | zh | ) |
Definition at line 2139 of file zebraapi.c.
References log_level, ZEBRA_CHECK_HANDLE, and zebra_commit_ex().
Referenced by main().
ZEBRA_RES zebra_close | ( | ZebraHandle | zh | ) |
Destroys Zebra session handle.
zh | zebra session handle. |
Definition at line 657 of file zebraapi.c.
References zebra_session::basenames, zebra_session::dbaccesslist, zebra_session::errCode, zebra_session::iconv_from_utf8, zebra_session::iconv_to_utf8, zebra_session::lock_normal, zebra_session::lock_shadow, log_level, zebra_session::m_limit, zebra_session::next, zebra_session::nmem_error, zebra_session::num_basenames, zebra_session::path_reg, zebra_session::record_encoding, zebra_session::reg, zebra_session::reg_name, res_close(), resultSetDestroy(), zebra_session::service, zebra_service::session_lock, zebra_session::session_res, zebra_service::sessions, zebra_session::user_perm, ZEBRA_CHECK_HANDLE, zebra_close_res(), zebra_limit_destroy(), zebra_lock_destroy(), zebra_mutex_cond_lock(), zebra_mutex_cond_unlock(), ZEBRA_OK, and zebra_register_close().
Referenced by bend_close(), main(), and zebra_stop().
ZEBRA_RES zebra_commit | ( | ZebraHandle | zh | ) |
Definition at line 2146 of file zebraapi.c.
References log_level, ZEBRA_CHECK_HANDLE, and zebra_commit_ex().
Referenced by es_admin_request(), main(), and zebra_begin_trans().
ZEBRA_RES zebra_compact | ( | ZebraHandle | zh | ) |
Definition at line 2187 of file zebraapi.c.
References bfs_create(), bfs_destroy(), zebra_session::errCode, inv_compact(), log_level, zebra_session::path_reg, zebra_session::res, res_get(), ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, and ZEBRA_OK.
Referenced by main().
ZEBRA_RES zebra_create_database | ( | ZebraHandle | zh, |
const char * | db | ||
) |
Creates a database.
zh | session handle |
db | database to be created |
Definition at line 1562 of file zebraapi.c.
References log_level, zebra_session::reg, zebra_begin_trans(), ZEBRA_CHECK_HANDLE, zebra_end_trans(), ZEBRA_FAIL, ZEBRA_OK, zebra_select_database(), zebra_setError(), zebraExplain_newDatabase(), and zebra_register::zei.
Referenced by es_admin_request(), and main().
int zebra_deleteResultSet | ( | ZebraHandle | zh, |
int | function, | ||
int | num_setnames, | ||
char ** | setnames, | ||
int * | statuses | ||
) |
Deletes one or more resultsets.
zh | session handle |
function | Z_DeleteResultSetRequest_{list,all} |
num_setnames | number of result sets |
setnames | result set names |
statuses | status result |
Definition at line 1314 of file zebraapi.c.
References ASSERTZH, log_level, resultSetDestroy(), zebra_begin_read(), zebra_end_read(), and map_baseinfo::zh.
Referenced by bend_delete().
ZEBRA_RES zebra_drop_database | ( | ZebraHandle | zh, |
const char * | db | ||
) |
Deletes a database (drop)
zh | session handle |
db | database to be deleted |
Definition at line 1518 of file zebraapi.c.
References delete_SU_handle(), dict_delete_subtree_ord(), zebra_register::isamb, log_level, zebra_register::matchDict, zebra_session::reg, zebra_begin_trans(), ZEBRA_CHECK_HANDLE, zebra_end_trans(), ZEBRA_FAIL, ZEBRA_OK, zebra_remove_file_match(), zebra_select_database(), zebra_setError(), zebraExplain_curDatabase(), zebraExplain_get_database_ord(), zebraExplain_removeDatabase(), zebraExplain_trav_ord(), and zebra_register::zei.
Referenced by es_admin_request(), and main().
ZEBRA_RES zebra_end_trans | ( | ZebraHandle | zh | ) |
Definition at line 1910 of file zebraapi.c.
References log_level, ZEBRA_CHECK_HANDLE, and zebra_end_transaction().
Referenced by bend_esrequest(), main(), zebra_admin_import_end(), zebra_create_database(), zebra_drop_database(), zebra_end_read(), and zebra_update_record().
ZEBRA_RES zebra_end_transaction | ( | ZebraHandle | zh, |
ZebraTransactionStatus * | stat | ||
) |
Definition at line 1919 of file zebraapi.c.
References bf_commitClean(), bfs_create(), bfs_destroy(), ZebraTransactionStatus::deleted, ZebraTransactionStatus::inserted, zebra_session::lock_normal, zebra_session::lock_shadow, log_level, zebra_session::path_reg, ZebraTransactionStatus::processed, zebra_session::records_deleted, zebra_session::records_inserted, zebra_session::records_processed, zebra_session::records_updated, zebra_session::reg, zebra_session::res, res_get(), resultSetInvalidate(), zebra_session::service, ZebraTransactionStatus::stime, zebra_session::trans_no, zebra_session::trans_w_no, ZebraTransactionStatus::updated, ZebraTransactionStatus::utime, ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, zebra_flush_reg(), zebra_get_state(), ZEBRA_OK, zebra_register_close(), zebra_set_state(), zebra_setError(), zebra_unlock(), zebraExplain_runNumberIncrement(), zebra_register::zei, and ZINT_FORMAT.
Referenced by zebra_end_trans().
char* zebra_errAdd | ( | ZebraHandle | zh | ) |
Returns additional info for last error.
zh | zebra session handle. |
Definition at line 1363 of file zebraapi.c.
References zebra_session::errString, log_level, and map_baseinfo::zh.
Referenced by main().
int zebra_errCode | ( | ZebraHandle | zh | ) |
Returns error code for last error.
zh | zebra session handle. |
Definition at line 1343 of file zebraapi.c.
References zebra_session::errCode, log_level, and map_baseinfo::zh.
Referenced by main().
const char* zebra_errString | ( | ZebraHandle | zh | ) |
Returns error string for last error.
zh | zebra session handle. |
Definition at line 1354 of file zebraapi.c.
References zebra_session::errCode, log_level, and map_baseinfo::zh.
Referenced by main().
void zebra_filter_info | ( | ZebraService | zs, |
void * | cd, | ||
void(*)(void *cd, const char *name) | cb | ||
) |
Lists enabled Zebra filters.
zs | service handle |
cd | callback parameter (opaque) |
cb | callback function |
Definition at line 306 of file zebraapi.c.
References ASSERTZS, zebra_service::record_classes, and recTypeClass_info().
Referenced by show_filters().
struct BFiles_struct* zebra_get_bfs | ( | ZebraHandle | zh | ) |
Definition at line 2733 of file zebraapi.c.
References zebra_register::bfs, and zebra_session::reg.
Referenced by zebra_register_statistics().
const char* zebra_get_encoding | ( | ZebraHandle | zh | ) |
Returns character set encoding for session.
zh | zebra session handle. |
Definition at line 107 of file zebraapi.c.
References res_get_def(), and zebra_session::session_res.
Referenced by bend_init(), and zebra_open().
const char* zebra_get_resource | ( | ZebraHandle | zh, |
const char * | name, | ||
const char * | defaultvalue | ||
) |
Definition at line 2565 of file zebraapi.c.
References ASSERTZH, log_level, zebra_session::res, and res_get_def().
Referenced by resultSetAdd().
ZEBRA_RES zebra_init | ( | ZebraHandle | zh | ) |
Definition at line 2154 of file zebraapi.c.
References bf_cache(), bf_reset(), bfs_create(), bfs_destroy(), log_level, zebra_session::path_reg, zebra_session::res, res_get(), ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, ZEBRA_OK, zebra_select_default_database(), zebra_set_state(), and zebra_setError().
Referenced by main().
ZebraMetaRecord* zebra_meta_records_create | ( | ZebraHandle | zh, |
const char * | name, | ||
int | num, | ||
zint * | positions | ||
) |
Definition at line 418 of file zsets.c.
References zebra_set::cache_position, zebra_set::cache_psysno, zebra_set::cache_rfd, ZebraMetaRecord::db, zebra_set_term_entry::db, zset_sort_info::entries, log_level_set, log_level_sort, loglevels(), zebra_session::m_staticrank, it_key::mem, zset_sort_info::num_entries, resultSetGet(), zebra_set::rset, rset_close(), rset_open, rset_read, RSETF_READ, ZebraMetaRecord::score, zset_sort_entry::score, zebra_set::sort_info, ZebraMetaRecord::sysno, zset_sort_entry::sysno, ZebraMetaRecord::term, zebra_set_term_entry::term, zebra_set::term_entries, zebra_set::term_entries_max, and ZINT_FORMAT.
Referenced by facet_fetch(), zebra_meta_records_create_range(), and zebra_records_retrieve().
ZebraMetaRecord* zebra_meta_records_create_range | ( | ZebraHandle | zh, |
const char * | name, | ||
zint | start, | ||
int | num | ||
) |
Definition at line 393 of file zsets.c.
References zebra_meta_records_create().
void zebra_meta_records_destroy | ( | ZebraHandle | zh, |
ZebraMetaRecord * | records, | ||
int | num | ||
) |
Definition at line 547 of file zsets.c.
Referenced by facet_fetch(), and zebra_records_retrieve().
ZEBRA_RES zebra_octet_term_encoding | ( | ZebraHandle | zh, |
const char * | encoding | ||
) |
Definition at line 2522 of file zebraapi.c.
References zebra_session::iconv_from_utf8, zebra_session::iconv_to_utf8, log_level, ZEBRA_CHECK_HANDLE, and ZEBRA_OK.
Referenced by bend_init().
ZebraHandle zebra_open | ( | ZebraService | zs, |
Res | res | ||
) |
Creates a Zebra session handle within service.
zs | service handle. |
res | resources to be used for the service (NULL for none) |
There should be one handle for each thread doing something with zebra, be that searching or indexing. In simple apps one handle is sufficient
Definition at line 113 of file zebraapi.c.
References zebra_session::approx_limit, zebra_session::basenames, zebra_session::break_handler_data, zebra_session::break_handler_func, zebra_session::dbaccesslist, DEFAULT_APPROX_LIMIT, zebra_session::destroyed, zebra_session::errCode, zebra_session::errString, zebra_service::global_res, zebra_session::iconv_from_utf8, zebra_session::iconv_to_utf8, zebra_session::lock_normal, zebra_session::lock_shadow, log_level, log_level_initialized, zebra_session::m_limit, zebra_session::m_segment_indexing, zebra_session::m_staticrank, zebra_session::next, zebra_session::nmem_error, zebra_session::num_basenames, zebra_session::path_reg, zebra_session::record_encoding, zebra_session::reg, zebra_session::reg_name, zebra_session::res, res_open(), zebra_session::service, zebra_service::session_lock, zebra_session::session_res, zebra_service::sessions, zebra_session::sets, zebra_session::shadow_enable, zebra_session::store_data_buf, zebra_session::trans_no, zebra_session::trans_w_no, zebra_session::user_perm, zebra_get_encoding(), zebra_limit_create(), zebra_mutex_cond_lock(), and zebra_mutex_cond_unlock().
Referenced by bend_init(), and main().
void zebra_pidfname | ( | ZebraService | zs, |
char * | path | ||
) |
Definition at line 314 of file zebraapi.c.
References ASSERTZS, zebra_service::global_res, and zebra_lock_prefix().
Referenced by bend_start(), and bend_stop().
ZEBRA_RES zebra_record_encoding | ( | ZebraHandle | zh, |
const char * | encoding | ||
) |
Definition at line 2545 of file zebraapi.c.
References log_level, zebra_session::record_encoding, ZEBRA_CHECK_HANDLE, and ZEBRA_OK.
Referenced by bend_init().
ZEBRA_RES zebra_records_retrieve | ( | ZebraHandle | zh, |
ODR | stream, | ||
const char * | setname, | ||
Z_RecordComposition * | comp, | ||
const Odr_oid * | input_format, | ||
int | num_recs, | ||
ZebraRetrievalRecord * | recs | ||
) |
Retrieve records from result set (after search)
zh | session handle |
stream | allocate records returned using this ODR |
setname | name of result set to retrieve records from |
comp | Z39.50 record composition |
input_format | transfer syntax (OID) |
num_recs | number of records to retrieve |
recs | store records in this structure (size is num_recs) |
Definition at line 1118 of file zebraapi.c.
References zebra_session::approx_limit, ZebraRetrievalRecord::base, ZebraRetrievalRecord::buf, ZebraMetaRecord::db, ZebraRetrievalRecord::errCode, ZebraRetrievalRecord::errString, ZebraRetrievalRecord::format, ZebraRetrievalRecord::len, log_level, zebra_session::res, ZebraRetrievalRecord::score, ZebraMetaRecord::score, ZebraRetrievalRecord::sysno, ZebraMetaRecord::sysno, ZebraMetaRecord::term, zebra_begin_read(), ZEBRA_CHECK_HANDLE, zebra_end_read(), ZEBRA_FAIL, zebra_meta_records_create(), zebra_meta_records_destroy(), ZEBRA_OK, zebra_record_fetch(), zebra_setError(), zebra_setError_zint(), zebra_snippets_create(), zebra_snippets_destroy(), zebra_snippets_hit_vector(), and map_baseinfo::zh.
Referenced by bend_fetch().
ZEBRA_RES zebra_register_check | ( | ZebraHandle | zh, |
const char * | spec | ||
) |
Definition at line 2413 of file zebraapi.c.
References zebra_session::m_file_verbose_limit, rec_free(), rec_get_next(), rec_get_root(), zebra_register::records, zebra_session::reg, zebra_begin_read(), ZEBRA_CHECK_DICT, ZEBRA_CHECK_ISAM, zebra_end_read(), ZEBRA_FAIL, ZEBRA_OK, zebra_record_check(), and ZINT_FORMAT.
Referenced by main().
int zebra_register_statistics | ( | ZebraHandle | zh, |
int | dumpdict | ||
) |
while hunting memory leaks
Definition at line 174 of file invstat.c.
References inv_stat_info::cksum, zebra_register::dict, dict_scan(), inv_stat_info::dumpwords, inv_stat_handle(), inv_stat_info::isam_bounds, inv_stat_info::isam_occurrences, zebra_register::isamb, isamb_block_info(), inv_stat_info::isamb_blocks, inv_stat_info::isamb_levels, inv_stat_info::isamb_sizes, zebra_register::isamc, isamc_block_size(), isamc_block_used(), IT_MAX_WORD, inv_stat_info::no_dict_bytes, inv_stat_info::no_dict_entries, inv_stat_info::no_isam_entries, rec_prstat(), zebra_register::records, zebra_session::reg, show_bfs_stats(), SINGLETON_TYPE, zebra_begin_read(), zebra_end_read(), zebra_get_bfs(), inv_stat_info::zh, ZINT_FORMAT, and ZINT_FORMAT0.
Referenced by main().
ZEBRA_RES zebra_repository_delete | ( | ZebraHandle | zh, |
const char * | path | ||
) |
Definition at line 2012 of file zebraapi.c.
References action_delete, and zebra_repository_index().
ZEBRA_RES zebra_repository_index | ( | ZebraHandle | zh, |
const char * | path, | ||
enum zebra_recctrl_action_t | action | ||
) |
Definition at line 2017 of file zebraapi.c.
References action_a_delete, action_delete, action_update, ASSERTZH, log_level, zebra_session::m_record_id, zebra_update_file_match(), and zebra_update_from_path().
Referenced by main(), zebra_repository_delete(), and zebra_repository_update().
ZEBRA_RES zebra_repository_show | ( | ZebraHandle | zh, |
const char * | path | ||
) |
Definition at line 2038 of file zebraapi.c.
References ASSERTZH, log_level, repositoryShow(), and ZEBRA_OK.
Referenced by main().
ZEBRA_RES zebra_repository_update | ( | ZebraHandle | zh, |
const char * | path | ||
) |
Definition at line 2007 of file zebraapi.c.
References action_update, and zebra_repository_index().
void zebra_result | ( | ZebraHandle | zh, |
int * | code, | ||
char ** | addinfo | ||
) |
Returns error code and additional info for last error.
zh | zebra session handle. |
code | pointer to returned error code |
addinfo | pointer to returned additional info |
Definition at line 2500 of file zebraapi.c.
References zebra_session::errCode, zebra_session::errString, and log_level.
Referenced by bend_esrequest(), bend_fetch(), bend_scan(), bend_search(), bend_sort(), and es_admin_request().
ZEBRA_RES zebra_result_set_term_info | ( | ZebraHandle | zh, |
const char * | setname, | ||
int | no, | ||
zint * | count, | ||
int * | approx, | ||
char * | termbuf, | ||
size_t * | termlen, | ||
const char ** | term_ref_id | ||
) |
returns information about a term assocated with a result set
zh | session handle |
setname | result set name |
no | the term we want to know about (0=first, 1=second,..) |
count | the number of occurrences of this term, aka hits (output) |
approx | about hits: 0=exact,1=approx (output) |
termbuf | buffer for term string (intput, output) |
termlen | size of termbuf (input=max, output=actual length) |
term_ref_id | if non-NULL *term_ref_id holds term reference |
Returns information about one search term associated with result set. Use zebra_result_set_term_no to read total number of terms associated with result set. If this function can not return information, due to no out of range or bad result set name, ZEBRA_FAIL is returned. The passed termbuf must be able to hold at least *termlen characters. Upon completion, *termlen holds actual length of search term.
Definition at line 1275 of file zsets.c.
References zebra_session::iconv_from_utf8, rset_term::name, rset_term::ref_id, resultSetGet(), zebra_set::rset, trav_rset_for_termids(), ZEBRA_FAIL, and ZEBRA_OK.
Referenced by search_terms().
ZEBRA_RES zebra_result_set_term_no | ( | ZebraHandle | zh, |
const char * | setname, | ||
int * | num_terms | ||
) |
returns number of term info terms assocaited with result set
zh | session handle |
setname | result set name |
num_terms | number of terms returned in this integer |
This function is used in conjunction with zebra_result_set_term_info. If operation was successful, ZEBRA_OK is returned; otherwise ZEBRA_FAIL is returned (typically non-existing setname)
Definition at line 1262 of file zsets.c.
References resultSetGet(), zebra_set::rset, trav_rset_for_termids(), ZEBRA_FAIL, and ZEBRA_OK.
Referenced by search_terms().
ZEBRA_RES zebra_scan | ( | ZebraHandle | zh, |
ODR | stream, | ||
Z_AttributesPlusTerm * | zapt, | ||
const Odr_oid * | attributeset, | ||
int * | position, | ||
int * | num_entries, | ||
ZebraScanEntry ** | entries, | ||
int * | is_partial, | ||
const char * | setname | ||
) |
performs Scan (Z39.50 style)
zh | session handle |
stream | ODR handle for result |
zapt | Attribute plus Term (start term) |
attributeset | Attributeset for Attribute plus Term |
position | input/output position |
num_entries | number of terms requested / returned |
entries | list of resulting terms (ODR allocated) |
is_partial | upon return 1=partial, 0=complete |
setname | limit scan by this set (NULL means no limit) |
Definition at line 1258 of file zebraapi.c.
References zebra_session::basenames, log_level, zebra_session::num_basenames, rpn_scan(), zebra_begin_read(), ZEBRA_CHECK_HANDLE, zebra_end_read(), ZEBRA_FAIL, and map_baseinfo::zh.
Referenced by bend_scan(), and zebra_scan_PQF().
ZEBRA_RES zebra_scan_PQF | ( | ZebraHandle | zh, |
ODR | stream, | ||
const char * | query, | ||
int * | position, | ||
int * | num_entries, | ||
ZebraScanEntry ** | entries, | ||
int * | is_partial, | ||
const char * | setname | ||
) |
performs Scan (taking PQF string)
zh | session handle |
stream | ODR handle for result |
query | PQF scan query |
position | input/output position |
num_entries | number of terms requested / returned |
entries | list of resulting terms (ODR allocated) |
is_partial | upon return 1=partial, 0=complete |
setname | limit scan by this set (NULL means no limit) |
Definition at line 1232 of file zebraapi.c.
References zebra_session::errCode, ZEBRA_FAIL, zebra_scan(), and map_baseinfo::zh.
ZEBRA_RES zebra_search_PQF | ( | ZebraHandle | zh, |
const char * | pqf_query, | ||
const char * | setname, | ||
zint * | hits | ||
) |
Search using PQF Query String.
zh | session handle |
pqf_query | query |
setname | name of resultset |
hits | of hits is returned |
Definition at line 2651 of file zebraapi.c.
References zebra_session::errCode, log_level, ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, ZEBRA_OK, zebra_search_RPN(), and ZINT_FORMAT.
ZEBRA_RES zebra_search_RPN | ( | ZebraHandle | zh, |
ODR | o, | ||
Z_RPNQuery * | query, | ||
const char * | setname, | ||
zint * | hits | ||
) |
Search using RPN Query structure (from ASN.1)
zh | session handle |
o | ODR handle |
query | RPN query using YAZ structure |
setname | name of resultset |
hits | number of hits is returned |
Definition at line 1108 of file zebraapi.c.
References zebra_search_RPN_x(), and map_baseinfo::zh.
Referenced by zebra_search_PQF().
ZEBRA_RES zebra_search_RPN_x | ( | ZebraHandle | zh, |
ODR | o, | ||
Z_RPNQuery * | query, | ||
const char * | setname, | ||
zint * | hits, | ||
int * | estimated_hit_count, | ||
int * | partial_resultset | ||
) |
Search using RPN Query structure (from ASN.1)
zh | session handle |
o | ODR handle |
query | RPN query using YAZ structure |
setname | name of resultset |
hits | number of hits is returned |
estimated_hit_count | whether hit count is an estimate |
partial_resultset | whether result is only partially evaluated |
Definition at line 1079 of file zebraapi.c.
References zebra_session::basenames, log_level, zebra_session::num_basenames, zebra_session::partial_result, resultSetAddRPN(), zebra_begin_read(), ZEBRA_CHECK_HANDLE, zebra_end_read(), ZEBRA_FAIL, and map_baseinfo::zh.
Referenced by bend_search(), and zebra_search_RPN().
ZEBRA_RES zebra_select_database | ( | ZebraHandle | zh, |
const char * | basename | ||
) |
Definition at line 939 of file zebraapi.c.
References log_level, ZEBRA_CHECK_HANDLE, zebra_select_databases(), and map_baseinfo::zh.
Referenced by bend_esrequest(), es_admin_request(), main(), zebra_admin_import_begin(), zebra_create_database(), zebra_drop_database(), and zebra_select_default_database().
ZEBRA_RES zebra_select_databases | ( | ZebraHandle | zh, |
int | num_bases, | ||
const char ** | basenames | ||
) |
Definition at line 948 of file zebraapi.c.
References zebra_session::basenames, map_baseinfo::basenames, zebra_session::dbaccesslist, zebra_session::errCode, zebra_session::lock_normal, zebra_session::lock_shadow, log_level, zebra_session::num_basenames, map_baseinfo::num_bases, zebra_session::res, ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, ZEBRA_OK, zebra_select_register(), and map_baseinfo::zh.
Referenced by bend_scan(), bend_search(), and zebra_select_database().
ZEBRA_RES zebra_set_approx_limit | ( | ZebraHandle | zh, |
zint | approx_limit | ||
) |
Set limit before Zebra does approx hit count.
zh | session handle |
approx_limit | the limit |
Results will be approximiate if hit count is greater than the limit specified. By default there is a high-limit (no limit).
Definition at line 1056 of file zebraapi.c.
References zebra_session::approx_limit, DEFAULT_APPROX_LIMIT, ZEBRA_OK, and map_baseinfo::zh.
Referenced by zebra_select_register().
ZEBRA_RES zebra_set_break_handler | ( | ZebraHandle | zh, |
int(*)(void *client_data) | f, | ||
void * | client_data | ||
) |
Definition at line 1070 of file zebraapi.c.
References zebra_session::break_handler_data, zebra_session::break_handler_func, ZEBRA_OK, and map_baseinfo::zh.
Referenced by bend_search().
ZEBRA_RES zebra_set_limit | ( | ZebraHandle | zh, |
int | complement_flag, | ||
zint * | ids | ||
) |
Definition at line 2744 of file zebraapi.c.
References zebra_session::m_limit, ZEBRA_CHECK_HANDLE, zebra_limit_create(), zebra_limit_destroy(), and ZEBRA_OK.
void zebra_set_resource | ( | ZebraHandle | zh, |
const char * | name, | ||
const char * | value | ||
) |
Definition at line 2556 of file zebraapi.c.
References ASSERTZH, log_level, zebra_session::res, and res_set().
void zebra_shadow_enable | ( | ZebraHandle | zh, |
int | value | ||
) |
Definition at line 2515 of file zebraapi.c.
References ASSERTZH, log_level, and zebra_session::shadow_enable.
Referenced by main().
ZEBRA_RES zebra_shutdown | ( | ZebraService | zs | ) |
ZEBRA_RES zebra_sort | ( | ZebraHandle | zh, |
ODR | stream, | ||
int | num_input_setnames, | ||
const char ** | input_setnames, | ||
const char * | output_setname, | ||
Z_SortKeySpecList * | sort_sequence, | ||
int * | sort_status | ||
) |
Definition at line 1291 of file zebraapi.c.
References log_level, resultSetSort(), zebra_begin_read(), ZEBRA_CHECK_HANDLE, zebra_end_read(), ZEBRA_FAIL, and map_baseinfo::zh.
Referenced by bend_sort().
ZebraService zebra_start | ( | const char * | configName | ) |
Creates a Zebra Service.
configName | name of configuration file |
This function is a simplified version of zebra_start_res.
Definition at line 192 of file zebraapi.c.
References zebra_start_res().
ZebraService zebra_start_res | ( | const char * | configName, |
Res | def_res, | ||
Res | over_res | ||
) |
Creates a Zebra service with resources.
configName | name of configuration file |
def_res | default resources |
over_res | overriding resources |
This function typically called once in a program. A Zebra Service acts as a factory for Zebra session handles.
Definition at line 197 of file zebraapi.c.
References zebra_service::dbaccess, zebra_service::global_res, log_level, log_level_initialized, zebra_service::nmem, zebra_service::passwd_db, passwd_db_file_crypt(), passwd_db_file_plain(), passwd_db_open(), zebra_service::path_root, zebra_service::record_classes, recTypeClass_create(), recTypeClass_load_modules(), res_close(), res_get(), res_open(), res_read_file(), zebra_service::session_lock, zebra_service::sessions, zebra_service::timing, zebra_chdir(), zebra_check_res(), zebra_flock_init(), zebra_get_version(), zebra_mutex_cond_init(), and ZEBRA_OK.
Referenced by bend_start(), main(), and zebra_start().
ZEBRA_RES zebra_stop | ( | ZebraService | zs | ) |
stops a Zebra service.
zs | service handle |
Frees resources used by the service.
Definition at line 627 of file zebraapi.c.
References zebra_service::global_res, zebra_service::nmem, zebra_service::passwd_db, passwd_db_close(), zebra_service::record_classes, recTypeClass_destroy(), res_close(), zebra_service::session_lock, zebra_service::sessions, zebra_service::timing, zebra_close(), zebra_mutex_cond_destroy(), and ZEBRA_OK.
Referenced by bend_start(), bend_stop(), and main().
int zebra_string_norm | ( | ZebraHandle | zh, |
const char * | index_type, | ||
const char * | input_str, | ||
int | input_len, | ||
char * | output_str, | ||
int | output_len | ||
) |
Normalize zebra term for register (subject to change!)
zh | session handle |
index_type | "w", "p",.. |
input_str | input string buffer |
input_len | input string length |
output_str | output string buffer |
output_len | output string length |
Definition at line 1587 of file zebraapi.c.
References ASSERTZH, log_level, zebra_session::reg, zebra_map_get(), zebra_register::zebra_maps, and zebra_replace().
ZEBRA_RES zebra_update_record | ( | ZebraHandle | zh, |
enum zebra_recctrl_action_t | action, | ||
const char * | recordType, | ||
zint * | sysno, | ||
const char * | match, | ||
const char * | fname, | ||
const char * | buf, | ||
int | buf_size | ||
) |
Updates record.
zh | session handle |
action | (insert,replace,delete or update (replace/insert) |
recordType | filter type (0 indicates default) |
sysno | system id (0 may be passed for no known id) |
match | match criteria (0 may be passed for no known criteria) |
fname | filename to be printed for logging (0 may be passed) |
buf | record buffer |
buf_size | record buffer size |
Definition at line 2611 of file zebraapi.c.
References log_level, zebra_begin_trans(), zebra_buffer_extract_record(), ZEBRA_CHECK_HANDLE, zebra_end_trans(), ZEBRA_FAIL, ZEBRA_OK, and ZINT_FORMAT.
Referenced by bend_esrequest(), zebra_add_record(), and zebra_admin_import_segment().