Maps Packages to IDs and vice-versa. More...
#include <popcon.h>
Classes | |
struct | GeneralInfo |
Public Member Functions | |
Popcon () | |
time_t | timestamp () const |
Get the timestamp of when the index was last updated. | |
bool | hasData () const |
Return true if this data source has data, false if it's empty. | |
size_t | submissions () const |
Return the total number of popcon submissions. | |
size_t | size () const |
Get the number of packages in the index. | |
std::string | name (size_t idx) const |
Get a package name by index. | |
float | scoreByIndex (size_t idx) const |
Get the score by index. | |
float | scoreByName (const std::string &name) const |
Get the score structure by package name. | |
float | score (size_t idx) const |
Get the score by index. | |
float | operator[] (int idx) const |
Get the score by index. | |
float | score (const std::string &name) const |
Get the score by name. | |
float | operator[] (const std::string &name) const |
Get the score structure by package name. |
Maps Packages to IDs and vice-versa.
This is used in building the Debtags fast index, which works representing tags and packages as int IDs.
Index building works like this: 1. The file all-popcon-results.txt.gz is downloaded from http://popcon.debian.org/all-popcon-results.txt.gz 2. The file is put in either ~/.popcon/all-popcon-results.txt.gz or in /var/lib/popcon/all-popcon-results.txt.gz 3. If the file is newer than the index, it will be automatically used to recompute the scores and rebuild the index.
ept::popcon::Popcon::Popcon | ( | ) |
References ept::popcon::PopconIndexer::obtainWorkingPopcon(), and timestamp().
bool ept::popcon::Popcon::hasData | ( | ) | const [inline] |
Return true if this data source has data, false if it's empty.
Referenced by TestPopcon::fallbackValues().
std::string ept::popcon::Popcon::name | ( | size_t | idx | ) | const [inline] |
Get a package name by index.
If the index is not valid, returns the empty string.
References ept::popcon::Score::offset.
Referenced by scoreByName().
float ept::popcon::Popcon::operator[] | ( | int | idx | ) | const [inline] |
Get the score by index.
References scoreByIndex().
float ept::popcon::Popcon::operator[] | ( | const std::string & | name | ) | const [inline] |
Get the score structure by package name.
References scoreByName().
float ept::popcon::Popcon::score | ( | size_t | idx | ) | const [inline] |
Get the score by index.
References scoreByIndex().
Referenced by TestPopcon::fallbackValues(), scoreByName(), and ept::popcon::Local::tfidf().
float ept::popcon::Popcon::score | ( | const std::string & | name | ) | const [inline] |
Get the score by name.
References scoreByName().
float ept::popcon::Popcon::scoreByIndex | ( | size_t | idx | ) | const [inline] |
Get the score by index.
References ept::popcon::Score::score.
Referenced by operator[](), and score().
float ept::popcon::Popcon::scoreByName | ( | const std::string & | name | ) | const |
Get the score structure by package name.
References name(), score(), and size().
Referenced by operator[](), and score().
size_t ept::popcon::Popcon::size | ( | ) | const [inline] |
Get the number of packages in the index.
Referenced by TestPopcon::fallbackValues(), and scoreByName().
size_t ept::popcon::Popcon::submissions | ( | ) | const [inline] |
Return the total number of popcon submissions.
Referenced by TestPopcon::fallbackValues(), and ept::popcon::Local::tfidf().
time_t ept::popcon::Popcon::timestamp | ( | ) | const [inline] |
Get the timestamp of when the index was last updated.
Referenced by TestPopcon::fallbackValues(), and Popcon().