IDZEBRA
2.2.7
|
#include <stdio.h>
#include <assert.h>
#include <fcntl.h>
#include "index.h"
#include <yaz/diagbib1.h>
#include <yaz/snprintf.h>
#include <direntz.h>
#include <yaz/oid_db.h>
#include <zebra_strmap.h>
Go to the source code of this file.
Data Structures | |
struct | special_fetch_s |
struct | index_spec |
struct | term_collect |
Macros | |
#define | MAX_SYSNOS_PER_RECORD 40 |
#define | ZEBRA_XML_HEADER_STR "<record xmlns=\"http://www.indexdata.com/zebra/\"" |
Functions | |
static int | zebra_create_record_stream (ZebraHandle zh, Record *rec, struct ZebraRecStream *stream) |
struct index_spec * | parse_index_spec (const char *elem, NMEM nmem, int *error) |
static int | sort_fetch (struct special_fetch_s *fi, const char *elemsetname, const Odr_oid *input_format, const Odr_oid **output_format, WRBUF result, WRBUF addinfo) |
static void | special_index_xml_record (ZebraHandle zh, WRBUF wrbuf, zebra_snippets *doc, zint sysno, struct index_spec *spec_list, const char *elemsetname, int use_xml) |
static int | special_index_fetch (struct special_fetch_s *fi, const char *elemsetname, const Odr_oid *input_format, const Odr_oid **output_format, WRBUF result, WRBUF addinfo, Record rec) |
static void | retrieve_puts_attr (WRBUF wrbuf, const char *name, const char *value) |
static void | retrieve_puts_attr_int (WRBUF wrbuf, const char *name, const int value) |
static void | retrieve_puts_str (WRBUF wrbuf, const char *name, const char *value) |
static void | retrieve_puts_int (WRBUF wrbuf, const char *name, const int value) |
static void | snippet_check_fields (ZebraHandle zh, WRBUF wrbuf, zebra_snippets *doc, const zebra_snippet_word *doc_w, const char *w_index_type) |
static void | snippet_xml_record (ZebraHandle zh, WRBUF wrbuf, zebra_snippets *doc) |
int | zebra_get_rec_snippets (ZebraHandle zh, zint sysno, zebra_snippets *snippets) |
static int | snippet_fetch (struct special_fetch_s *fi, const char *elemsetname, const Odr_oid *input_format, const Odr_oid **output_format, WRBUF result, WRBUF addinfo) |
static zint | freq_term (ZebraHandle zh, int ord, const char *term, RSET rset_set, zint *first_sysno, zint *first_seq) |
static int | term_qsort_handle (const void *a, const void *b) |
static void | term_collect_freq (ZebraHandle zh, struct term_collect *col, int no_terms_collect, int ord, RSET rset, double scale_factor) |
static struct term_collect * | term_collect_create (zebra_strmap_t sm, int no_terms_collect, NMEM nmem) |
static int | perform_facet_sort (ZebraHandle zh, int no_ord, int *ord_array, zebra_strmap_t *map_array, int num_recs, ZebraMetaRecord *poset) |
static int | perform_facet_index (ZebraHandle zh, struct special_fetch_s *fi, int no_ord, int *ord_array, zebra_strmap_t *map_array, int num_recs, ZebraMetaRecord *poset, struct index_spec *spec_list) |
static int | perform_facet (ZebraHandle zh, struct special_fetch_s *fi, WRBUF result, int num_recs, ZebraMetaRecord *poset, struct index_spec *spec_list, int no_ord, int *ord_array, int use_xml, zinfo_index_category_t cat) |
static int | facet_fetch (struct special_fetch_s *fi, const char *elemsetname, const Odr_oid *input_format, const Odr_oid **output_format, WRBUF result, WRBUF addinfo) |
static int | zebra_special_fetch (void *handle, const char *elemsetname, const Odr_oid *input_format, const Odr_oid **output_format, WRBUF result, WRBUF addinfo) |
int | zebra_record_fetch (ZebraHandle zh, const char *setname, zint sysno, int score, ODR odr, const Odr_oid *input_format, Z_RecordComposition *comp, const Odr_oid **output_format, char **rec_bufp, int *rec_lenp, char **basenamep, WRBUF addinfo_w) |
Variables | |
static int | log_level_mod = 0 |
static int | log_level_set = 0 |
#define MAX_SYSNOS_PER_RECORD 40 |
Definition at line 42 of file retrieve.c.
#define ZEBRA_XML_HEADER_STR "<record xmlns=\"http://www.indexdata.com/zebra/\"" |
Definition at line 44 of file retrieve.c.
|
static |
Definition at line 943 of file retrieve.c.
References error(), index_spec::index_name, index_spec::index_type, index_spec::next, special_fetch_s::nmem, parse_index_spec(), perform_facet(), zebra_session::reg, zebra_session::res, res_get_int(), special_fetch_s::setname, zebra_meta_records_create(), zebra_meta_records_destroy(), ZEBRA_OK, ZEBRA_XML_HEADER_STR, zebraExplain_lookup_attr_str(), zebra_register::zei, special_fetch_s::zh, zinfo_index_category_index, and zinfo_index_category_sort.
Referenced by zebra_special_fetch().
|
static |
Definition at line 562 of file retrieve.c.
References zebra_session::approx_limit, rset_key_control::dec, zebra_register::dict, dict_lookup(), IT_MAX_WORD, key_SU_encode(), it_key::len, it_key::mem, zebra_session::reg, rset_close(), rset_create_and(), rset_delete(), rset_dup(), rset_open, rset_read, rset_term_create(), RSETF_READ, rset_key_control::scope, zebra_count_set(), zebra_create_rset_isam(), and zebra_key_control_create().
Referenced by term_collect_freq().
struct index_spec* parse_index_spec | ( | const char * | elem, |
NMEM | nmem, | ||
int * | error | ||
) |
Definition at line 100 of file retrieve.c.
References error(), index_spec::extra, index_spec::index_name, index_spec::index_type, and index_spec::next.
Referenced by facet_fetch(), sort_fetch(), and special_index_fetch().
|
static |
Definition at line 813 of file retrieve.c.
References index_spec::extra, term_collect::first_seqno, term_collect::first_sysno, index_spec::index_name, index_spec::index_type, log_level_mod, zebra_snippet_word::next, index_spec::next, special_fetch_s::nmem, term_collect::oc, zebra_snippet_word::ord, perform_facet_index(), perform_facet_sort(), resultSetRef(), zebra_snippet_word::seqno, term_collect::set_occur, special_fetch_s::setname, zebra_snippet_word::term, term_collect::term, term_collect_create(), term_collect_freq(), zebra_snippet_word::ws, zebra_get_rec_snippets(), zebra_snippets_constlist(), zebra_snippets_create(), zebra_snippets_destroy(), zebra_snippets_log(), zebra_strmap_create(), zebra_strmap_destroy(), zebra_term_untrans_iconv(), zebra_term_untrans_iconv2(), zinfo_index_category_sort, and ZINT_FORMAT.
Referenced by facet_fetch().
|
static |
Definition at line 742 of file retrieve.c.
References CAST_ZINT_TO_INT, FIRST_IN_FIELD_CHAR, MAX_SYSNOS_PER_RECORD, it_key::mem, index_spec::next, rec_free(), rec_get(), recInfo_delKeys, zebra_register::records, zebra_session::reg, zebra_session::res, res_get_int(), special_fetch_s::setname, ZebraMetaRecord::sysno, zebra_rec_keys_close(), zebra_rec_keys_empty(), zebra_rec_keys_open(), zebra_rec_keys_read(), zebra_rec_keys_rewind(), zebra_rec_keys_set_buf(), zebra_result_recid_to_sysno(), zebra_strmap_add(), zebra_strmap_lookup(), and ZINT_FORMAT.
Referenced by perform_facet().
|
static |
Definition at line 698 of file retrieve.c.
References zebra_session::reg, zebra_register::sort_index, ZebraMetaRecord::sysno, zebra_sort_read(), zebra_sort_sysno(), zebra_sort_type(), zebra_strmap_add(), and zebra_strmap_lookup().
Referenced by perform_facet().
|
static |
Definition at line 354 of file retrieve.c.
Referenced by zebra_special_fetch().
|
static |
Definition at line 365 of file retrieve.c.
Referenced by zebra_special_fetch().
|
static |
Definition at line 378 of file retrieve.c.
Referenced by zebra_special_fetch().
|
static |
Definition at line 371 of file retrieve.c.
Referenced by zebra_special_fetch().
|
static |
Definition at line 385 of file retrieve.c.
References index_spec::index_type, zebra_snippet_word::next, zebra_snippet_word::ord, zebra_session::reg, zebra_snippet_word::seqno, zebra_snippets_constlist(), zebraExplain_lookup_ord(), and zebra_register::zei.
Referenced by snippet_xml_record().
|
static |
Definition at line 508 of file retrieve.c.
References log_level_mod, special_fetch_s::setname, snippet_xml_record(), special_fetch_s::sysno, zebra_get_rec_snippets(), zebra_snippets_create(), zebra_snippets_destroy(), zebra_snippets_hit_vector(), zebra_snippets_log(), zebra_snippets_ring(), and special_fetch_s::zh.
Referenced by zebra_special_fetch().
|
static |
Definition at line 420 of file retrieve.c.
References index_spec::index_type, zebra_snippet_word::mark, zebra_snippet_word::match, zebra_snippet_word::next, zebra_snippet_word::ord, zebra_session::reg, snippet_check_fields(), zebra_snippet_word::term, zebra_snippet_word::ws, zebra_snippets_constlist(), ZEBRA_XML_HEADER_STR, zebraExplain_lookup_ord(), and zebra_register::zei.
Referenced by snippet_fetch().
|
static |
Definition at line 158 of file retrieve.c.
References error(), index_spec::index_name, index_spec::index_type, IT_MAX_WORD, index_spec::next, special_fetch_s::nmem, parse_index_spec(), zebra_session::reg, zebra_register::sort_index, special_fetch_s::sysno, zebra_sort_read(), zebra_sort_sysno(), zebra_sort_type(), zebra_term_untrans(), ZEBRA_XML_HEADER_STR, zebraExplain_lookup_attr_str(), zebraExplain_lookup_ord(), zebra_register::zei, special_fetch_s::zh, zinfo_index_category_sort, and ZINT_FORMAT.
Referenced by zebra_special_fetch().
|
static |
Definition at line 303 of file retrieve.c.
References error(), index_spec::index_name, index_spec::index_type, index_spec::next, special_fetch_s::nmem, parse_index_spec(), zebra_session::reg, special_index_xml_record(), special_fetch_s::sysno, zebra_get_rec_snippets(), zebra_snippets_create(), zebra_snippets_destroy(), zebraExplain_lookup_attr_str(), zebra_register::zei, special_fetch_s::zh, and zinfo_index_category_index.
Referenced by zebra_special_fetch().
|
static |
Definition at line 248 of file retrieve.c.
References index_spec::index_name, index_spec::index_type, zebra_snippet_word::next, index_spec::next, zebra_snippet_word::ord, zebra_session::reg, zebra_snippet_word::seqno, zebra_snippet_word::term, zebra_snippets_constlist(), ZEBRA_XML_HEADER_STR, zebraExplain_lookup_ord(), zebra_register::zei, and ZINT_FORMAT.
Referenced by special_index_fetch().
|
static |
Definition at line 655 of file retrieve.c.
References term_collect::first_seqno, term_collect::first_sysno, term_collect::oc, term_collect::set_occur, term_collect::term, zebra_strmap_it_create(), zebra_strmap_it_destroy(), and zebra_strmap_it_next().
Referenced by perform_facet().
|
static |
Definition at line 633 of file retrieve.c.
References term_collect::first_seqno, term_collect::first_sysno, freq_term(), term_collect::oc, term_collect::set_occur, term_collect::term, and term_qsort_handle().
Referenced by perform_facet().
|
static |
Definition at line 617 of file retrieve.c.
References term_collect::set_occur, and term_collect::term.
Referenced by term_collect_freq().
|
static |
Definition at line 57 of file retrieve.c.
References fd, O_BINARY, zebra_session::path_reg, rec_free(), rec_init_attr(), recInfo_filename, recInfo_storeData, RecordAttr::recordOffset, zebra_session::reg, zebra_create_stream_fd(), zebra_create_stream_mem(), and zebra_register::zei.
Referenced by zebra_get_rec_snippets(), zebra_record_fetch(), and zebra_special_fetch().
int zebra_get_rec_snippets | ( | ZebraHandle | zh, |
zint | sysno, | ||
zebra_snippets * | snippets | ||
) |
Definition at line 465 of file retrieve.c.
References ZebraRecStream::destroy, extract_snippet(), record_info::info, log_level_mod, log_level_set, rec_free(), rec_get(), recInfo_fileType, zebra_register::records, recType_byName(), zebra_register::recTypes, zebra_session::reg, zebra_session::res, zebra_create_record_stream(), and ZINT_FORMAT.
Referenced by perform_facet(), scan_save_set(), snippet_fetch(), and special_index_fetch().
int zebra_record_fetch | ( | ZebraHandle | zh, |
const char * | setname, | ||
zint | sysno, | ||
int | score, | ||
ODR | odr, | ||
const Odr_oid * | input_format, | ||
Z_RecordComposition * | comp, | ||
const Odr_oid ** | output_format, | ||
char ** | rec_bufp, | ||
int * | rec_lenp, | ||
char ** | basenamep, | ||
WRBUF | addinfo_w | ||
) |
Definition at line 1197 of file retrieve.c.
References recRetrieveCtrl::addinfo, recRetrieveCtrl::comp, ZebraRecStream::destroy, recRetrieveCtrl::dh, zebra_register::dh, recRetrieveCtrl::diagnostic, recRetrieveCtrl::encoding, recRetrieveCtrl::fname, recRetrieveCtrl::handle, record_info::info, recRetrieveCtrl::input_format, recRetrieveCtrl::localno, log_level_mod, log_level_set, MAX_SYSNOS_PER_RECORD, special_fetch_s::nmem, recRetrieveCtrl::odr, recRetrieveCtrl::output_format, recRetrieveCtrl::rec_buf, rec_free(), rec_get(), rec_init_attr(), recRetrieveCtrl::rec_len, recInfo_databaseName, recInfo_filename, recInfo_fileType, zebra_session::record_encoding, zebra_register::records, recRetrieveCtrl::recordSize, recType_byName(), zebra_register::recTypes, zebra_session::reg, recRetrieveCtrl::res, zebra_session::res, recType::retrieve, recRetrieveCtrl::score, special_fetch_s::score, special_fetch_s::setname, recRetrieveCtrl::special_fetch, recRetrieveCtrl::staticrank, recRetrieveCtrl::stream, special_fetch_s::sysno, zebra_create_record_stream(), ZEBRA_FAIL, ZEBRA_OK, zebra_result_recid_to_sysno(), zebra_special_fetch(), zebra_register::zei, special_fetch_s::zh, and ZINT_FORMAT.
Referenced by zebra_records_retrieve().
|
static |
Definition at line 1043 of file retrieve.c.
References ZebraRecStream::destroy, facet_fetch(), record_info::info, special_fetch_s::nmem, ZebraRecStream::readf, rec_free(), rec_get(), rec_init_attr(), recInfo_databaseName, recInfo_filename, recInfo_fileType, zebra_register::records, RecordAttr::recordSize, zebra_session::reg, retrieve_puts_attr(), retrieve_puts_attr_int(), retrieve_puts_int(), retrieve_puts_str(), special_fetch_s::score, snippet_fetch(), sort_fetch(), special_index_fetch(), RecordAttr::staticrank, special_fetch_s::sysno, zebra_create_record_stream(), ZEBRA_XML_HEADER_STR, zebra_register::zei, special_fetch_s::zh, and ZINT_FORMAT.
Referenced by zebra_record_fetch().
|
static |
Definition at line 54 of file retrieve.c.
Referenced by perform_facet(), snippet_fetch(), zebra_get_rec_snippets(), and zebra_record_fetch().
|
static |
Definition at line 55 of file retrieve.c.
Referenced by zebra_get_rec_snippets(), and zebra_record_fetch().