ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | Private Attributes | List of all members
meta::index::ranker Class Referenceabstract

A ranker scores a query against all the documents in an inverted index, returning a list of documents sorted by relevance. More...

#include <ranker.h>

Inheritance diagram for meta::index::ranker:
meta::index::language_model_ranker meta::index::okapi_bm25 meta::index::pivoted_length meta::index::absolute_discount meta::index::dirichlet_prior meta::index::jelinek_mercer

Public Member Functions

std::vector< std::pair< doc_id, double > > score (inverted_index &idx, corpus::document &query, uint64_t num_results=10, const std::function< bool(doc_id d_id)> &filter=[](doc_id){return true;})
 
virtual double score_one (const score_data &sd)=0
 Computes the contribution to the score of a document for a matched query term. More...
 
virtual double initial_score (const score_data &sd) const
 Computes the constant contribution to the score of a particular document. More...
 
virtual ~ranker ()=default
 Default destructor.
 

Private Attributes

std::vector< double > results_
 results per doc_id
 

Detailed Description

A ranker scores a query against all the documents in an inverted index, returning a list of documents sorted by relevance.

Member Function Documentation

std::vector< std::pair< doc_id, double > > meta::index::ranker::score ( inverted_index idx,
corpus::document query,
uint64_t  num_results = 10,
const std::function< bool(doc_id d_id)> &  filter = [](doc_id) { return true; } 
)
Parameters
idxThe index this ranker is operating on
queryThe current query
num_resultsThe number of results to return in the vector
filterA filtering function to apply to each doc_id; returns true if the document should be included in results
virtual double meta::index::ranker::score_one ( const score_data sd)
pure virtual

Computes the contribution to the score of a document for a matched query term.

Parameters
sdThe score_data for this query

Implemented in meta::index::okapi_bm25, meta::index::pivoted_length, and meta::index::language_model_ranker.

double meta::index::ranker::initial_score ( const score_data sd) const
virtual

Computes the constant contribution to the score of a particular document.

Parameters
sdThe score_data for the query

Reimplemented in meta::index::language_model_ranker.


The documentation for this class was generated from the following files: