IDZEBRA
2.2.7
|
#include <stdio.h>
#include <string.h>
#include <idzebra/util.h>
#include <assert.h>
#include <yaz/nmem.h>
#include <rset.h>
Go to the source code of this file.
Functions | |
RSFD | rfd_create_base (RSET rs) |
Common constuctor for RFDs. More... | |
static void | rset_close_int (RSET rs, RSFD rfd) |
void | rset_set_hits_limit (RSET rs, zint l) |
void | rset_close (RSFD rfd) |
Closes a result set RFD handle. 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... | |
int | rfd_is_last (RSFD rfd) |
Test for last use of RFD. More... | |
RSET | rset_dup (RSET rs) |
Duplicate an RSET. More... | |
zint | rset_count (RSET rs) |
Estimates hit count for result set. More... | |
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... | |
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_read (RSFD rfd, void *buf, TERMID *term) |
int | rset_default_forward (RSFD rfd, void *buf, TERMID *term, const void *untilbuf) |
void | rset_visit (RSET rset, int level) |
int | rset_no_write (RSFD rfd, const void *buf) |
Variables | |
static int | log_level = 0 |
static int | log_level_initialized = 0 |
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().
Definition at line 69 of file rset.c.
References rset::control, rset_control::desc, rset_control::f_close, rset::free_list, log_level, rsfd::next, rsfd::priv, and rset::use_list.
Referenced by rset_close(), and rset_count().
Estimates hit count for result set.
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_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_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().
|
static |
Definition at line 30 of file rset.c.
Referenced by rfd_create_base(), rset_close(), rset_close_int(), rset_create_base(), rset_default_forward(), rset_delete(), rset_dup(), and rset_set_hits_limit().
|
static |
Definition at line 31 of file rset.c.
Referenced by rset_create_base().