PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <limits.h>
#include <math.h>
#include "miscadmin.h"
#include "tsearch/ts_utils.h"
#include "utils/array.h"
#include "utils/fmgrprotos.h"
Go to the source code of this file.
Data Structures | |
struct | DocRepresentation |
struct | QueryRepresentationOperand |
struct | QueryRepresentation |
struct | CoverExt |
Macros | |
#define | NUM_WEIGHTS 4 |
#define | wpos(wep) ( w[ WEP_GETWEIGHT(wep) ] ) |
#define | RANK_NO_NORM 0x00 |
#define | RANK_NORM_LOGLENGTH 0x01 |
#define | RANK_NORM_LENGTH 0x02 |
#define | RANK_NORM_EXTDIST 0x04 |
#define | RANK_NORM_UNIQ 0x08 |
#define | RANK_NORM_LOGUNIQ 0x10 |
#define | RANK_NORM_RDIVRPLUS1 0x20 |
#define | DEF_NORM_METHOD RANK_NO_NORM |
#define | WordECompareQueryItem(e, q, p, i, m) |
#define | MAXQROPOS MAXENTRYPOS |
#define | QR_GET_OPERAND_DATA(q, v) ( (q)->operandData + (((QueryItem*)(v)) - GETQUERY((q)->query)) ) |
Variables | |
static const float | default_weights [NUM_WEIGHTS] = {0.1f, 0.2f, 0.4f, 1.0f} |
#define DEF_NORM_METHOD RANK_NO_NORM |
#define MAXQROPOS MAXENTRYPOS |
#define wpos | ( | wep | ) | ( w[ WEP_GETWEIGHT(wep) ] ) |
Definition at line 358 of file tsrank.c.
References calc_rank_and(), calc_rank_or(), cnt_length(), GETQUERY, len, OP_AND, OP_PHRASE, QueryOperator::oper, QI_OPR, QueryItem::qoperator, RANK_NORM_LENGTH, RANK_NORM_LOGLENGTH, RANK_NORM_LOGUNIQ, RANK_NORM_RDIVRPLUS1, RANK_NORM_UNIQ, res, TSVectorData::size, TSQueryData::size, and QueryItem::type.
Referenced by ts_rank_tt(), ts_rank_ttf(), ts_rank_wtt(), and ts_rank_wttf().
Definition at line 201 of file tsrank.c.
References _POSVECPTR, calc_rank_or(), find_wordentry(), WordEntry::haspos, i, MAXENTRYPOS, WordEntryPosVector::npos, WordEntryPosVector1::npos, palloc0(), pfree(), WordEntryPosVector1::pos, WordEntryPosVector::pos, res, size, TSQueryData::size, SortAndUniqItems(), WEP_GETPOS, WEP_SETPOS, word_distance(), and wpos.
Referenced by calc_rank().
|
static |
Definition at line 855 of file tsrank.c.
References CoverExt::begin, cnt_length(), Cover(), default_weights, CoverExt::end, ereport, errcode(), errmsg(), ERROR, get_docrep(), i, len, MemSet, NUM_WEIGHTS, QueryRepresentation::operandData, CoverExt::p, palloc0(), pfree(), DocRepresentation::pos, CoverExt::q, QueryRepresentation::query, RANK_NORM_EXTDIST, RANK_NORM_LENGTH, RANK_NORM_LOGLENGTH, RANK_NORM_LOGUNIQ, RANK_NORM_RDIVRPLUS1, RANK_NORM_UNIQ, TSVectorData::size, TSQueryData::size, and WEP_GETWEIGHT.
Referenced by ts_rankcd_tt(), ts_rankcd_ttf(), ts_rankcd_wtt(), and ts_rankcd_wttf().
Definition at line 284 of file tsrank.c.
References find_wordentry(), WordEntry::haspos, i, j, WordEntryPosVector1::npos, pfree(), WordEntryPosVector1::pos, POSDATALEN, POSDATAPTR, res, size, TSQueryData::size, SortAndUniqItems(), and wpos.
Referenced by calc_rank(), and calc_rank_and().
|
static |
Definition at line 568 of file tsrank.c.
References data, MAXQROPOS, QueryRepresentationOperand::npos, QueryRepresentationOperand::operandexists, QueryRepresentationOperand::pos, QR_GET_OPERAND_DATA, QueryRepresentationOperand::reverseinsert, TS_NO, TS_YES, and val.
Referenced by Cover().
|
static |
Definition at line 54 of file tsrank.c.
References ARRPTR, len, POSDATALEN, and STRPTR.
Referenced by calc_rank(), and calc_rank_cd().
|
static |
Definition at line 524 of file tsrank.c.
References a, b, WEP_GETPOS, and WEP_GETWEIGHT.
Referenced by get_docrep().
|
static |
Definition at line 136 of file tsrank.c.
References a, arg, b, QueryOperand::distance, QueryOperand::length, and tsCompareString().
Referenced by SortAndUniqItems().
|
static |
Definition at line 651 of file tsrank.c.
References CoverExt::begin, check_stack_depth(), checkcondition_QueryOperand(), CoverExt::end, fillQueryRepresentationData(), GETQUERY, len, CoverExt::p, DocRepresentation::pos, CoverExt::pos, CoverExt::q, QueryRepresentation::query, resetQueryRepresentation(), TS_EXEC_EMPTY, TS_execute(), and WEP_GETPOS.
Referenced by calc_rank_cd().
|
static |
Definition at line 611 of file tsrank.c.
References DocRepresentation::data, i, MAXQROPOS, QueryRepresentationOperand::npos, QueryRepresentationOperand::operandexists, DocRepresentation::pos, QueryRepresentationOperand::pos, QI_VAL, QR_GET_OPERAND_DATA, DocRepresentation::query, QueryRepresentationOperand::reverseinsert, and WEP_GETPOS.
Referenced by Cover().
|
static |
Definition at line 87 of file tsrank.c.
References ARRPTR, difference(), GETOPERAND, QueryOperand::prefix, STRPTR, and WordECompareQueryItem.
Referenced by calc_rank_and(), calc_rank_or(), and get_docrep().
|
static |
Definition at line 732 of file tsrank.c.
References compareDocR(), cur, DocRepresentation::data, find_wordentry(), GETQUERY, WordEntry::haspos, i, j, len, DocRepresentation::map, palloc(), pfree(), DocRepresentation::pos, POSDATALEN, POSDATAPTR, QI_VAL, QueryItem::qoperand, qsort, QueryRepresentation::query, repalloc(), TSQueryData::size, storage, type, QueryOperand::weight, and WEP_GETWEIGHT.
Referenced by calc_rank_cd().
|
static |
Definition at line 405 of file tsrank.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_NDIM, array_contains_nulls(), ArrayGetNItems(), Assert, default_weights, ereport, errcode(), errmsg(), ERROR, i, and NUM_WEIGHTS.
Referenced by ts_rank_wtt(), ts_rank_wttf(), ts_rankcd_wtt(), and ts_rankcd_wttf().
|
static |
Definition at line 598 of file tsrank.c.
References i, QueryRepresentationOperand::npos, QueryRepresentation::operandData, QueryRepresentationOperand::operandexists, QueryRepresentation::query, QueryRepresentationOperand::reverseinsert, and TSQueryData::size.
Referenced by Cover().
|
static |
Definition at line 155 of file tsrank.c.
References compareQueryOperand(), GETOPERAND, GETQUERY, palloc(), QI_VAL, qsort_arg(), res, size, and QueryItem::type.
Referenced by calc_rank_and(), and calc_rank_or().
Datum ts_rank_tt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 491 of file tsrank.c.
References calc_rank(), DEF_NORM_METHOD, default_weights, PG_FREE_IF_COPY, PG_GETARG_TSQUERY, PG_GETARG_TSVECTOR, PG_RETURN_FLOAT4, and res.
Datum ts_rank_ttf | ( | PG_FUNCTION_ARGS | ) |
Definition at line 476 of file tsrank.c.
References calc_rank(), default_weights, PG_FREE_IF_COPY, PG_GETARG_INT32, PG_GETARG_TSQUERY, PG_GETARG_TSVECTOR, PG_RETURN_FLOAT4, and res.
Datum ts_rank_wtt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 458 of file tsrank.c.
References calc_rank(), DEF_NORM_METHOD, getWeights(), NUM_WEIGHTS, PG_DETOAST_DATUM, PG_FREE_IF_COPY, PG_GETARG_DATUM, PG_GETARG_TSQUERY, PG_GETARG_TSVECTOR, PG_RETURN_FLOAT4, and res.
Datum ts_rank_wttf | ( | PG_FUNCTION_ARGS | ) |
Definition at line 439 of file tsrank.c.
References calc_rank(), getWeights(), NUM_WEIGHTS, PG_DETOAST_DATUM, PG_FREE_IF_COPY, PG_GETARG_DATUM, PG_GETARG_INT32, PG_GETARG_TSQUERY, PG_GETARG_TSVECTOR, PG_RETURN_FLOAT4, and res.
Datum ts_rankcd_tt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1010 of file tsrank.c.
References calc_rank_cd(), DEF_NORM_METHOD, default_weights, PG_FREE_IF_COPY, PG_GETARG_TSQUERY, PG_GETARG_TSVECTOR, PG_RETURN_FLOAT4, and res.
Datum ts_rankcd_ttf | ( | PG_FUNCTION_ARGS | ) |
Definition at line 995 of file tsrank.c.
References calc_rank_cd(), default_weights, PG_FREE_IF_COPY, PG_GETARG_INT32, PG_GETARG_TSQUERY, PG_GETARG_TSVECTOR, PG_RETURN_FLOAT4, and res.
Datum ts_rankcd_wtt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 977 of file tsrank.c.
References calc_rank_cd(), DEF_NORM_METHOD, getWeights(), NUM_WEIGHTS, PG_DETOAST_DATUM, PG_FREE_IF_COPY, PG_GETARG_DATUM, PG_GETARG_TSQUERY, PG_GETARG_TSVECTOR, PG_RETURN_FLOAT4, and res.
Datum ts_rankcd_wttf | ( | PG_FUNCTION_ARGS | ) |
Definition at line 958 of file tsrank.c.
References calc_rank_cd(), getWeights(), NUM_WEIGHTS, PG_DETOAST_DATUM, PG_FREE_IF_COPY, PG_GETARG_DATUM, PG_GETARG_INT32, PG_GETARG_TSQUERY, PG_GETARG_TSVECTOR, PG_RETURN_FLOAT4, and res.
|
static |
Definition at line 25 of file tsrank.c.
Referenced by calc_rank_cd(), getWeights(), ts_rank_tt(), ts_rank_ttf(), ts_rankcd_tt(), and ts_rankcd_ttf().