pazpar2  1.13.0
Data Structures | Functions | Variables
relevance.c File Reference
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include "relevance.h"
#include "session.h"
#include "client.h"
#include "settings.h"

Go to the source code of this file.

Data Structures

struct  relevance
 
struct  word_entry
 
struct  norm_client
 
struct  norm_record
 

Functions

struct norm_clientfindnorm (struct relevance *rel, struct client *client)
 
static void setup_norm_record (struct relevance *rel, struct record_cluster *clust)
 
static double squaresum (struct norm_record *rp, double a, double b)
 
static void normalize_scores (struct relevance *rel)
 
static struct word_entryword_entry_match (struct relevance *r, const char *norm_str, const char *rank, int *weight)
 
int relevance_snippet (struct relevance *r, const char *words, const char *name, WRBUF w_snippet)
 
void relevance_countwords (struct relevance *r, struct record_cluster *cluster, const char *words, const char *rank, const char *name)
 
static void pull_terms (struct relevance *res, struct ccl_rpn_node *n)
 
void relevance_clear (struct relevance *r)
 
struct relevancerelevance_create_ccl (pp2_charset_fact_t pft, struct ccl_rpn_node *query, int rank_cluster, double follow_factor, double lead_decay, int length_divide)
 
void relevance_destroy (struct relevance **rp)
 
void relevance_mergerec (struct relevance *r, struct record_cluster *dst, const struct record_cluster *src)
 
void relevance_newrec (struct relevance *r, struct record_cluster *rec)
 
void relevance_donerecord (struct relevance *r, struct record_cluster *cluster)
 
void relevance_prepare_read (struct relevance *rel, struct reclist *reclist)
 

Variables

const int scorefield_none = -1
 
const int scorefield_internal = -2
 
const int scorefield_position = -3
 

Function Documentation

struct norm_client* findnorm ( struct relevance rel,
struct client client 
)
static void normalize_scores ( struct relevance rel)
static
static void pull_terms ( struct relevance res,
struct ccl_rpn_node *  n 
)
static
void relevance_clear ( struct relevance r)

Definition at line 530 of file relevance.c.

References relevance::doc_frequency_vec, and relevance::vec_len.

Referenced by relevance_create_ccl(), and session_clear_set().

void relevance_countwords ( struct relevance r,
struct record_cluster cluster,
const char *  words,
const char *  rank,
const char *  name 
)
struct relevance* relevance_create_ccl ( pp2_charset_fact_t  pft,
struct ccl_rpn_node *  query,
int  rank_cluster,
double  follow_factor,
double  lead_decay,
int  length_divide 
)
void relevance_destroy ( struct relevance **  rp)

Definition at line 575 of file relevance.c.

References pp2_charset_token_destroy().

Referenced by session_destroy(), and session_search().

void relevance_donerecord ( struct relevance r,
struct record_cluster cluster 
)
void relevance_mergerec ( struct relevance r,
struct record_cluster dst,
const struct record_cluster src 
)
void relevance_newrec ( struct relevance r,
struct record_cluster rec 
)
void relevance_prepare_read ( struct relevance rel,
struct reclist reclist 
)
int relevance_snippet ( struct relevance r,
const char *  words,
const char *  name,
WRBUF  w_snippet 
)
static void setup_norm_record ( struct relevance rel,
struct record_cluster clust 
)
static
static double squaresum ( struct norm_record rp,
double  a,
double  b 
)
static

Definition at line 178 of file relevance.c.

References norm_record::next, record::position, norm_record::record, and norm_record::score.

Referenced by normalize_scores().

static struct word_entry* word_entry_match ( struct relevance r,
const char *  norm_str,
const char *  rank,
int *  weight 
)
static

Variable Documentation

const int scorefield_internal = -2

Definition at line 78 of file relevance.c.

Referenced by findnorm(), and setup_norm_record().

const int scorefield_none = -1

Definition at line 76 of file relevance.c.

Referenced by findnorm(), normalize_scores(), and setup_norm_record().

const int scorefield_position = -3

Definition at line 79 of file relevance.c.

Referenced by findnorm(), normalize_scores(), and setup_norm_record().