IDZEBRA  2.1.2
Data Structures | Macros | Functions | Variables
zsets.c File Reference
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include "index.h"
#include "rank.h"
#include <yaz/diagbib1.h>
#include <rset.h>

Go to the source code of this file.

Data Structures

struct  zebra_set_term_entry
 
struct  zebra_set
 
struct  zset_sort_entry
 
struct  zset_sort_info
 
struct  sortKeyInfo
 

Macros

#define ZSET_SORT_MAX_LEVEL   10
 

Functions

static void loglevels (void)
 
static ZEBRA_RES resultSetSearch (ZebraHandle zh, NMEM nmem, NMEM rset_nmem, Z_RPNQuery *rpn, ZebraSet sset)
 
ZEBRA_RES resultSetAddRPN (ZebraHandle zh, NMEM m, Z_RPNQuery *rpn, int num_bases, char **basenames, const char *setname, zint *hits, int *estimated_hit_count)
 
void resultSetAddTerm (ZebraHandle zh, ZebraSet s, int reg_type, const char *db, const char *index_name, const char *term)
 
ZebraSet resultSetAdd (ZebraHandle zh, const char *name, int ov)
 
ZebraSet resultSetGet (ZebraHandle zh, const char *name)
 
ZEBRA_RES resultSetGetBaseNames (ZebraHandle zh, const char *setname, const char ***basenames, int *num_bases)
 
void resultSetInvalidate (ZebraHandle zh)
 
void resultSetDestroy (ZebraHandle zh, int num, char **names, int *statuses)
 
ZebraMetaRecordzebra_meta_records_create_range (ZebraHandle zh, const char *name, zint start, int num)
 
ZebraMetaRecordzebra_meta_records_create (ZebraHandle zh, const char *name, int num, zint *positions)
 
void zebra_meta_records_destroy (ZebraHandle zh, ZebraMetaRecord *records, int num)
 
void resultSetInsertSort (ZebraHandle zh, ZebraSet sset, int database_no, struct sortKeyInfo *criteria, int num_criteria, zint sysno, char *cmp_buf[], char *tmp_cmp_buf[])
 
void resultSetInsertRank (ZebraHandle zh, struct zset_sort_info *sort_info, zint sysno, int score, int relation)
 
static Z_RPNQuery * copy_RPNQuery (Z_RPNQuery *src, NMEM nmem)
 
static Z_SortKeySpecList * copy_SortKeySpecList (Z_SortKeySpecList *src, NMEM nmem)
 
ZebraSet resultSetClone (ZebraHandle zh, const char *setname, ZebraSet rset)
 
ZEBRA_RES resultSetSort (ZebraHandle zh, NMEM nmem, int num_input_setnames, const char **input_setnames, const char *output_setname, Z_SortKeySpecList *sort_sequence, int *sort_status)
 
ZEBRA_RES resultSetSortSingle (ZebraHandle zh, NMEM nmem, ZebraSet sset, RSET rset, Z_SortKeySpecList *sort_sequence, int *sort_status)
 
RSET resultSetRef (ZebraHandle zh, const char *resultSetId)
 
ZEBRA_RES resultSetRank (ZebraHandle zh, ZebraSet zebraSet, RSET rset, NMEM nmem)
 
ZebraRankClass zebraRankLookup (ZebraHandle zh, const char *name)
 
void zebraRankInstall (struct zebra_register *reg, struct rank_control *ctrl)
 
void zebraRankDestroy (struct zebra_register *reg)
 
static int trav_rset_for_termids (RSET rset, TERMID *termid_array, zint *hits_array, int *approx_array)
 
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_snippets_hit_vector (ZebraHandle zh, const char *setname, zint sysno, zebra_snippets *snippets)
 
static ZEBRA_RES zebra_recid_to_sysno (ZebraHandle zh, const char **basenames, int num_bases, zint recid, zint *sysnos, int *no_sysnos)
 
ZEBRA_RES zebra_result_recid_to_sysno (ZebraHandle zh, const char *setname, zint recid, zint *sysnos, int *no_sysnos)
 
void zebra_count_set (ZebraHandle zh, RSET rset, zint *count, zint approx_limit)
 

Variables

static int log_level_set =0
 
static int log_level_sort =0
 
static int log_level_searchhits =0
 
static int log_level_searchterms =0
 
static int log_level_resultsets =0
 

Macro Definition Documentation

#define ZSET_SORT_MAX_LEVEL   10

Definition at line 37 of file zsets.c.

Referenced by resultSetSortSingle().

Function Documentation

static Z_RPNQuery* copy_RPNQuery ( Z_RPNQuery *  src,
NMEM  nmem 
)
static

Definition at line 755 of file zsets.c.

Referenced by resultSetClone().

static Z_SortKeySpecList* copy_SortKeySpecList ( Z_SortKeySpecList *  src,
NMEM  nmem 
)
static

Definition at line 778 of file zsets.c.

Referenced by resultSetSort().

static void loglevels ( void  )
static
ZebraSet resultSetAdd ( ZebraHandle  zh,
const char *  name,
int  ov 
)
ZEBRA_RES resultSetAddRPN ( ZebraHandle  zh,
NMEM  m,
Z_RPNQuery *  rpn,
int  num_bases,
char **  basenames,
const char *  setname,
zint hits,
int *  estimated_hit_count 
)
void resultSetAddTerm ( ZebraHandle  zh,
ZebraSet  s,
int  reg_type,
const char *  db,
const char *  index_name,
const char *  term 
)
ZebraSet resultSetClone ( ZebraHandle  zh,
const char *  setname,
ZebraSet  rset 
)
void resultSetDestroy ( ZebraHandle  zh,
int  num,
char **  names,
int *  statuses 
)
ZebraSet resultSetGet ( ZebraHandle  zh,
const char *  name 
)
ZEBRA_RES resultSetGetBaseNames ( ZebraHandle  zh,
const char *  setname,
const char ***  basenames,
int *  num_bases 
)
void resultSetInsertRank ( ZebraHandle  zh,
struct zset_sort_info sort_info,
zint  sysno,
int  score,
int  relation 
)
void resultSetInsertSort ( ZebraHandle  zh,
ZebraSet  sset,
int  database_no,
struct sortKeyInfo criteria,
int  num_criteria,
zint  sysno,
char *  cmp_buf[],
char *  tmp_cmp_buf[] 
)
void resultSetInvalidate ( ZebraHandle  zh)
ZEBRA_RES resultSetRank ( ZebraHandle  zh,
ZebraSet  zebraSet,
RSET  rset,
NMEM  nmem 
)
RSET resultSetRef ( ZebraHandle  zh,
const char *  resultSetId 
)

Definition at line 1075 of file zsets.c.

References resultSetGet(), and zebra_set::rset.

Referenced by perform_facet(), rpn_scan(), and rpn_search_structure().

static ZEBRA_RES resultSetSearch ( ZebraHandle  zh,
NMEM  nmem,
NMEM  rset_nmem,
Z_RPNQuery *  rpn,
ZebraSet  sset 
)
static
ZEBRA_RES resultSetSort ( ZebraHandle  zh,
NMEM  nmem,
int  num_input_setnames,
const char **  input_setnames,
const char *  output_setname,
Z_SortKeySpecList *  sort_sequence,
int *  sort_status 
)
ZEBRA_RES resultSetSortSingle ( ZebraHandle  zh,
NMEM  nmem,
ZebraSet  sset,
RSET  rset,
Z_SortKeySpecList *  sort_sequence,
int *  sort_status 
)
static int trav_rset_for_termids ( RSET  rset,
TERMID termid_array,
zint hits_array,
int *  approx_array 
)
static
void zebra_count_set ( ZebraHandle  zh,
RSET  rset,
zint count,
zint  approx_limit 
)

Definition at line 1498 of file zsets.c.

References rset::hits_count, rset::hits_limit, it_key::mem, rset_close(), rset_open, rset_read, and RSETF_READ.

Referenced by freq_term(), and scan_save_set().

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 
)

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().

static ZEBRA_RES zebra_recid_to_sysno ( ZebraHandle  zh,
const char **  basenames,
int  num_bases,
zint  recid,
zint sysnos,
int *  no_sysnos 
)
static
ZEBRA_RES zebra_result_recid_to_sysno ( ZebraHandle  zh,
const char *  setname,
zint  recid,
zint sysnos,
int *  no_sysnos 
)
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

Parameters
zhsession handle
setnameresult set name
nothe term we want to know about (0=first, 1=second,..)
countthe number of occurrences of this term, aka hits (output)
approxabout hits: 0=exact,1=approx (output)
termbufbuffer for term string (intput, output)
termlensize of termbuf (input=max, output=actual length)
term_ref_idif 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

Parameters
zhsession handle
setnameresult set name
num_termsnumber 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_snippets_hit_vector ( ZebraHandle  zh,
const char *  setname,
zint  sysno,
zebra_snippets snippets 
)
void zebraRankDestroy ( struct zebra_register reg)
void zebraRankInstall ( struct zebra_register reg,
struct rank_control ctrl 
)
ZebraRankClass zebraRankLookup ( ZebraHandle  zh,
const char *  name 
)

Variable Documentation

int log_level_resultsets =0
static

Definition at line 85 of file zsets.c.

Referenced by loglevels(), resultSetAdd(), resultSetGet(), and resultSetInvalidate().

int log_level_searchhits =0
static

Definition at line 83 of file zsets.c.

Referenced by loglevels(), resultSetRank(), and resultSetSortSingle().

int log_level_searchterms =0
static

Definition at line 84 of file zsets.c.

Referenced by loglevels(), and resultSetRank().

int log_level_set =0
static
int log_level_sort =0
static