IDZEBRA
2.2.7
|
#include <yaz/yaz-util.h>
#include <idzebra/isamb.h>
#include <idzebra/isamc.h>
#include <idzebra/isams.h>
Go to the source code of this file.
Data Structures | |
struct | ord_list |
struct | rset_term |
struct | rsfd |
struct | rset_control |
struct | rset_key_control |
struct | rset |
Macros | |
#define | RSETF_READ 0 |
#define | RSETF_WRITE 1 |
#define | rset_open(rs, wflag) (*(rs)->control->f_open)((rs), (wflag)) |
#define | rset_forward(rfd, buf, term, untilbuf) rset_default_forward((rfd), (buf), (term), (untilbuf)) |
#define | rset_getterms(ct, terms, maxterms, curterm) (*(ct)->control->f_getterms)((ct),(terms),(maxterms),(curterm)) |
#define | rset_pos(rfd, cur, tot) (*(rfd)->rset->control->f_pos)((rfd),(cur),(tot)) |
#define | rset_read(rfd, buf, term) rset_default_read((rfd), (buf), (term)) |
#define | rset_write(rfd, buf) (*(rfd)->rset->control->f_write)((rfd), (buf)) |
#define | rset_type(rs) ((rs)->control->desc) |
Typedefs | |
typedef struct rsfd * | RSFD |
typedef struct rset * | RSET |
typedef struct rset_term * | TERMID |
typedef struct rset | rset |
Functions | |
struct ord_list * | ord_list_create (NMEM nmem) |
struct ord_list * | ord_list_append (NMEM nmem, struct ord_list *list, int ord) |
struct ord_list * | ord_list_dup (NMEM nmem, struct ord_list *list) |
void | ord_list_print (struct ord_list *list) |
TERMID | rset_term_create (const char *name, int length, const char *flags, int type, NMEM nmem, struct ord_list *ol, int reg_type, zint hits_limit, const char *ref_id) |
Creates a TERMID entry. More... | |
int | rset_default_forward (RSFD rfd, void *buf, TERMID *term, const void *untilbuf) |
int | rset_default_read (RSFD rfd, void *buf, TERMID *term) |
void | rset_get_one_term (RSET ct, TERMID *terms, int maxterms, int *curterm) |
is a getterms function for those that don't have any More... | |
RSFD | rfd_create_base (RSET rs) |
Common constuctor for RFDs. More... | |
int | rfd_is_last (RSFD rfd) |
Test for last use of RFD. More... | |
RSET | rset_create_base (const struct rset_control *sel, NMEM nmem, struct rset_key_control *kcontrol, int scope, TERMID term, int no_children, RSET *children) |
Common constuctor for RSETs. More... | |
void | rset_delete (RSET rs) |
Destructor RSETs. More... | |
RSET | rset_dup (RSET rs) |
Duplicate an RSET. More... | |
void | rset_close (RSFD rfd) |
Closes a result set RFD handle. More... | |
zint | rset_count (RSET rs) |
Estimates hit count for result set. More... | |
RSET | rset_create_temp (NMEM nmem, struct rset_key_control *kcontrol, int scope, const char *temp_path, TERMID term) |
RSET | rset_create_null (NMEM nmem, struct rset_key_control *kcontrol, TERMID term) |
RSET | rset_create_not (NMEM nmem, struct rset_key_control *kcontrol, int scope, RSET rset_l, RSET rset_r) |
RSET | rset_create_between (NMEM nmem, struct rset_key_control *kcontrol, int scope, RSET rset_l, RSET rset_m1, RSET rset_m2, RSET rset_r, RSET rset_attr) |
RSET | rset_create_or (NMEM nmem, struct rset_key_control *kcontrol, int scope, TERMID termid, int no_rsets, RSET *rsets) |
RSET | rset_create_and (NMEM nmem, struct rset_key_control *kcontrol, int scope, int no_rsets, RSET *rsets) |
RSET | rset_create_prox (NMEM nmem, struct rset_key_control *kcontrol, int scope, int rset_no, RSET *rset, int ordered, int exclusion, int relation, int distance) |
RSET | rsisamb_create (NMEM nmem, struct rset_key_control *kcontrol, int scope, ISAMB is, ISAM_P pos, TERMID term) |
RSET | rsisamc_create (NMEM nmem, struct rset_key_control *kcontrol, int scope, ISAMC is, ISAM_P pos, TERMID term) |
RSET | rsisams_create (NMEM nmem, struct rset_key_control *kcontrol, int scope, ISAMS is, ISAM_P pos, TERMID term) |
void | rset_visit (RSET rset, int level) |
void | rset_set_hits_limit (RSET rs, zint l) |
int | rset_no_write (RSFD rfd, const void *buf) |
#define rset_forward | ( | rfd, | |
buf, | |||
term, | |||
untilbuf | |||
) | rset_default_forward((rfd), (buf), (term), (untilbuf)) |
#define rset_getterms | ( | ct, | |
terms, | |||
maxterms, | |||
curterm | |||
) | (*(ct)->control->f_getterms)((ct),(terms),(maxterms),(curterm)) |
#define rset_open | ( | rs, | |
wflag | |||
) | (*(rs)->control->f_open)((rs), (wflag)) |
#define rset_read | ( | rfd, | |
buf, | |||
term | |||
) | rset_default_read((rfd), (buf), (term)) |
A rset is an ordered sequence of keys, either directly from an underlaying isam, or from one of the higher-level operator rsets (and, or, ...). Actually, it is "virtual base class", no pure rsets exist in the system, they all are of some derived type.
Definition at line 306 of file rset.c.
References ord_list::next, and ord_list::ord.
Referenced by numeric_term(), ord_list_dup(), scan_save_set(), and string_term().
struct ord_list* ord_list_create | ( | NMEM | nmem | ) |
Definition at line 301 of file rset.c.
Referenced by numeric_term(), ord_list_dup(), scan_save_set(), and string_term().
Definition at line 315 of file rset.c.
References ord_list::next, ord_list::ord, ord_list_append(), and ord_list_create().
Referenced by rset_term_create().
void ord_list_print | ( | struct ord_list * | list | ) |
Definition at line 323 of file rset.c.
References ord_list::next, and ord_list::ord.
Referenced by resultSetSortSingle().
Common constuctor for RFDs.
rs | Result set handle. |
Creates an rfd. Either allocates a new one, in which case the priv pointer is null, and will have to be filled in, or picks up one from the freelist, in which case the priv is already allocated, and presumably everything that hangs from it as well
Definition at line 43 of file rset.c.
References rsfd::counted_buf, rsfd::counted_items, rset::free_list, rset_key_control::key_size, rset::keycontrol, log_level, rsfd::next, rset::nmem, rsfd::priv, rsfd::rset, and rset::use_list.
Referenced by r_open(), and r_open_andor().
int rfd_is_last | ( | RSFD | rfd | ) |
Test for last use of RFD.
rfd | RFD handle. |
Returns 1 if this RFD is the last reference to it; 0 otherwise.
Definition at line 242 of file rset.c.
References rsfd::next, rsfd::rset, and rset::use_list.
Referenced by r_close().
void rset_close | ( | RSFD | rfd | ) |
Closes a result set RFD handle.
rfd | the RFD handle. |
Definition at line 98 of file rset.c.
References rset::control, rsfd::counted_items, rset_control::desc, rset::hits_approx, rset::hits_count, rset::hits_limit, rset::hits_round, log_level, rsfd::rset, rset_close_int(), rset_default_read(), rset_pos, and ZINT_FORMAT.
Referenced by freq_term(), get_first_snippet_from_rset(), r_close(), resultSetAdd(), resultSetDestroy(), resultSetInvalidate(), resultSetRank(), resultSetSortSingle(), rpn_search_APT_local(), rset_trunc_r(), zebra_count_set(), zebra_meta_records_create(), and zebra_snippets_hit_vector().
Estimates hit count for result set.
rset_count counts or estimates the keys in it
rs | Result Set. |
rset_count uses rset_pos to get the total and returns that. This is ok for rsisamb/c/s, and for some other rsets, but in case of booleans etc it will give bad estimate, as nothing has been read from that rset
Definition at line 272 of file rset.c.
References rset_close_int(), rset_open, and rset_pos.
Referenced by begin().
RSET rset_create_and | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
int | no_rsets, | ||
RSET * | rsets | ||
) |
Definition at line 280 of file rsmultiandor.c.
References control_and, rsmulti_andor_create(), and scope.
Referenced by freq_term(), rpn_search_APT_and_list(), rpn_search_APT_numeric(), rpn_search_structure(), rset_create_between(), scan_save_set(), and zebra_snippets_hit_vector().
RSET rset_create_base | ( | const struct rset_control * | sel, |
NMEM | nmem, | ||
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
TERMID | term, | ||
int | no_children, | ||
RSET * | children | ||
) |
Common constuctor for RSETs.
sel | The interface control handle |
nmem | The memory handle for it. |
kcontrol | Key control info (decode, encode, comparison etc) |
scope | scope for set |
term | Information about term for it (NULL for none). |
no_children | number of child rsets (0 for none) |
children | child rsets (NULL for none). |
Creates an rfd. Either allocates a new one, in which case the priv pointer is null, and will have to be filled in, or picks up one from the freelist, in which case the priv is already allocated, and presumably everything that hangs from it as well
Definition at line 164 of file rset.c.
References rset::children, rset::control, rset_control::desc, rset::free_list, rset::hits_count, rset_term::hits_limit, rset::hits_limit, rset::hits_round, rset_key_control::inc, rset::keycontrol, log_level, log_level_initialized, rset::nmem, rset::no_children, rset::priv, rset_term::ref_id, rset::refcount, rset_term::rset, rset::scope, scope, rset::term, and rset::use_list.
Referenced by rsbool_create_base(), rset_create_between(), rset_create_null(), rset_create_prox(), rset_create_temp(), rsisamb_create(), rsisamc_create(), rsisams_create(), and rsmulti_andor_create().
RSET rset_create_between | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
RSET | rset_l, | ||
RSET | rset_m1, | ||
RSET | rset_m2, | ||
RSET | rset_r, | ||
RSET | rset_attr | ||
) |
Definition at line 101 of file rsbetween.c.
References rset_between_info::attrterm, checkterm(), rset::children, control, rset_between_info::hit2_terms, log_level, log_level_initialized, rset::nmem, rset::no_children, rset::priv, rset_create_and(), rset_create_base(), scope, rset_between_info::startterm, rset_between_info::stopterm, and rset::term.
Referenced by rpn_search_structure(), and rpn_search_xpath().
RSET rset_create_not | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
RSET | rset_l, | ||
RSET | rset_r | ||
) |
Definition at line 92 of file rsbool.c.
References control_not, rsbool_create_base(), rset_private::rset_l, rset_private::rset_r, and scope.
Referenced by rpn_search_structure().
RSET rset_create_null | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
TERMID | term | ||
) |
Definition at line 47 of file rsnull.c.
References control, rset::priv, and rset_create_base().
Referenced by rpn_search_APT(), rpn_search_APT_and_list(), rpn_search_APT_local(), rpn_search_APT_numeric(), rpn_search_APT_or_list(), rpn_search_APT_phrase(), rpn_sort_spec(), rset_trunc(), xpath_trunc(), and zebra_create_rset_isam().
RSET rset_create_or | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
TERMID | termid, | ||
int | no_rsets, | ||
RSET * | rsets | ||
) |
Definition at line 273 of file rsmultiandor.c.
References control_or, rsmulti_andor_create(), and scope.
Referenced by rpn_search_APT(), rpn_search_APT_or_list(), rpn_search_structure(), rset_trunc(), and scan_save_set().
RSET rset_create_prox | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
int | rset_no, | ||
RSET * | rset, | ||
int | ordered, | ||
int | exclusion, | ||
int | relation, | ||
int | distance | ||
) |
Definition at line 72 of file rsprox.c.
References control, rset_prox_info::distance, rset_prox_info::exclusion, rset::nmem, rset_prox_info::ordered, rset::priv, rset_prox_info::relation, rset_create_base(), and scope.
Referenced by rpn_search_APT_and_list(), rpn_search_APT_or_list(), rpn_search_APT_phrase(), and rpn_search_structure().
RSET rset_create_temp | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
const char * | temp_path, | ||
TERMID | term | ||
) |
Definition at line 86 of file rstemp.c.
References rset_private::buf_mem, rset_private::buf_size, control, rset_private::dirty, rset_private::fd, rset_private::fname, rset_private::hits, log_level, log_level_initialized, rset::nmem, rset_private::pos_buf, rset_private::pos_end, rset::priv, rset_create_base(), scope, and rset_private::temp_path.
Referenced by rpn_search_APT_local(), rset_trunc_r(), and zebra_snippets_hit_vector().
rset_default_forward implements a generic forward with a read-loop
Definition at line 396 of file rset.c.
References rset_key_control::cmp, rset::control, rsfd::counted_items, rset_control::f_forward, rset::hits_limit, rset::keycontrol, log_level, rsfd::rset, rset_default_forward(), rset_read, and rset::scope.
Referenced by rset_default_forward().
rset_default_read implements a generic read
Definition at line 371 of file rset.c.
References rset_key_control::cmp, rset::control, rsfd::counted_buf, rsfd::counted_items, rset_control::f_read, key_logdump_txt(), rset_key_control::key_size, rset::keycontrol, rsfd::rset, and rset::scope.
Referenced by rset_close().
void rset_delete | ( | RSET | rs | ) |
Destructor RSETs.
rs | Handle for result set. |
Destroys a result set and all its children. The f_delete method of control is called for the result set.
Definition at line 218 of file rset.c.
References rset::children, rset::control, rset_key_control::dec, rset_control::desc, rset_control::f_delete, rset::keycontrol, log_level, rset::no_children, rset::refcount, rset_delete(), and rset::use_list.
Referenced by freq_term(), resultSetAdd(), resultSetDestroy(), resultSetInvalidate(), rpn_search_APT(), rpn_search_APT_and_list(), rpn_search_APT_or_list(), rpn_search_APT_phrase(), rpn_search_structure(), rpn_search_top(), rset_delete(), rset_trunc_r(), scan_save_set(), search_terms_chrmap(), and zebra_snippets_hit_vector().
Duplicate an RSET.
rs | Handle for result set. |
Duplicates a result set by incrementing the reference count to it.
Definition at line 255 of file rset.c.
References rset::control, rset_control::desc, log_level, and rset::refcount.
Referenced by freq_term(), resultSetClone(), rpn_search_structure(), scan_save_set(), and zebra_snippets_hit_vector().
is a getterms function for those that don't have any
ct | result set handle |
terms | array of terms (0..maxterms-1) |
maxterms | length of terms array |
curterm | current size of terms array |
If there is a term associated with rset the term is appeneded; otherwise the terms array is untouched but curterm is incremented anyway.
Definition at line 291 of file rset.c.
References rset::term.
Referenced by r_get_terms().
int rset_no_write | ( | RSFD | rfd, |
const void * | buf | ||
) |
Definition at line 431 of file rset.c.
References rset::control, rset_control::desc, and rsfd::rset.
Definition at line 88 of file rset.c.
References rset::hits_limit, log_level, and ZINT_FORMAT.
Referenced by resultSetSearch(), and resultSetSortSingle().
TERMID rset_term_create | ( | const char * | name, |
int | length, | ||
const char * | flags, | ||
int | type, | ||
NMEM | nmem, | ||
struct ord_list * | ol, | ||
int | reg_type, | ||
zint | hits_limit, | ||
const char * | ref_id | ||
) |
Creates a TERMID entry.
name | Term/Name buffer with given length |
length | of term |
flags | for term |
type | Term Type, Z_Term_general, Z_Term_characterString,.. |
nmem | memory for term. |
ol | ord list |
reg_type | register type |
hits_limit | limit before counting stops and gets approximate |
ref_id | supplied ID for term that can be used to identify this |
Definition at line 340 of file rset.c.
References rset_term::flags, rset_term::hits_limit, rset_term::name, rset_term::ol, ord_list_dup(), rset_term::rankpriv, rset_term::ref_id, rset_term::reg_type, rset_term::rset, and rset_term::type.
Referenced by checkterm(), freq_term(), and rset_trunc().
void rset_visit | ( | RSET | rset, |
int | level | ||
) |
Definition at line 421 of file rset.c.
References rset::children, rset::hits_approx, rset::hits_count, rset::no_children, rset_visit(), and ZINT_FORMAT.
Referenced by rset_visit().
RSET rsisamb_create | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
ISAMB | is, | ||
ISAM_P | pos, | ||
TERMID | term | ||
) |
Definition at line 76 of file rsisamb.c.
References control, control_filter, rset_key_control::filter_func, rset_private::is, log_level, log_level_initialized, rset::nmem, rset_private::pos, rset::priv, rset_create_base(), and scope.
Referenced by rset_trunc(), and zebra_create_rset_isam().
RSET rsisamc_create | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
ISAMC | is, | ||
ISAM_P | pos, | ||
TERMID | term | ||
) |
Definition at line 61 of file rsisamc.c.
References control, rset_isamc_info::is, log_level, log_level_initialized, rset::nmem, rset_isamc_info::pos, rset::priv, rset_create_base(), and scope.
Referenced by zebra_create_rset_isam().
RSET rsisams_create | ( | NMEM | nmem, |
struct rset_key_control * | kcontrol, | ||
int | scope, | ||
ISAMS | is, | ||
ISAM_P | pos, | ||
TERMID | term | ||
) |
Definition at line 57 of file rsisams.c.
References control, rset_private::is, rset::nmem, rset_private::pos, rset::priv, rset_create_base(), and scope.
Referenced by zebra_create_rset_isam().