26 #include <wibble/sys/fs.h> 30 namespace textsearch {
44 wibble::sys::fs::mkdirIfMissing(name, 0755);
56 : md( TEST_ENV_DIR
"xapian"), oid( TEST_ENV_DIR
"xapian")
61 }
catch (Xapian::Error& e) {
62 cerr << e.get_type() <<
" " << e.get_msg() <<
" " << e.get_context() << endl;
90 Xapian::Enquire enq(textsearch.
db());
92 Xapian::MSet matches = enq.get_mset(0, 100);
93 assert(matches.size() > 0);
97 for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
98 results.insert(i.get_document().get_data());
99 assert(results.find(
"sp") != results.end());
105 Xapian::Enquire enq(textsearch.
db());
107 Xapian::MSet matches = enq.get_mset(0, 100);
108 assert(matches.size() > 0);
112 for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
113 results.insert(i.get_document().get_data());
114 assert(results.find(
"sp") != results.end());
120 Xapian::Enquire enq(textsearch.
db());
122 Xapian::MSet matches = enq.get_mset(0, 100);
123 assert(matches.size() > 0);
127 for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
128 results.insert(i.get_document().get_data());
129 assert(results.find(
"sp") != results.end());
136 assert_eq(textsearch.
docidByName(
"thereisnopackagewiththisname"), 0u);
148 assert(dval == 2408);
150 assert(dval == 741486);
158 assert(val == 741486);
DirMaker md
Definition: textsearch.test.h:50
int getIntValue(const std::string &pkgname, Xapian::valueno val_id) const
Get the integer value for.
Definition: textsearch.cc:240
time_t timestamp() const
Timestamp of when the Xapian database was last updated.
Definition: textsearch.h:136
Test values()
Definition: textsearch.test.h:140
Apt apt
Definition: textsearch.test.h:52
const Xapian::valueno VAL_APT_PACKAGE_SIZE
Definition: textsearch.h:43
Definition: packagerecord.test.h:22
Definition: textsearch/maint/path.h:51
-*- C++ -*- (c) 2006, 2007 Petr Rockai me@mornfall.net
Definition: apt.cc:43
Definition: textsearch.test.h:40
double getDoubleValue(const std::string &pkgname, Xapian::valueno val_id) const
Get the integer value for.
Definition: textsearch.cc:227
Xapian::Query makePartialORQuery(const std::string &keywords) const
Tokenize the string and build an OR query with the resulting keywords.
Definition: textsearch.cc:153
DirMaker(const std::string &name)
Definition: textsearch.test.h:42
Test docidByName()
Definition: textsearch.test.h:133
bool rebuildIfNeeded(apt::Apt &apt, const std::vector< const ExtraIndexer * > &extraIndexers=std::vector< const ExtraIndexer * >())
Rebuild the index if needed.
Definition: textsearch.cc:81
High-level access to the Apt cache, as a data provider for the ept framework.
Definition: apt/apt.h:60
Test queryAccess()
Definition: textsearch.test.h:103
High-level front-end to libapt-pkg, as a data provider for the ept framework.
Xapian::Query makeORQuery(const std::string &keywords) const
Tokenize the string and build an OR query with the resulting keywords.
Definition: textsearch.cc:147
bool hasData() const
Returns true if the index has data.
Definition: textsearch.h:139
Maintains and accesses a Xapian index of package descriptions.
Definition: textsearch.h:102
Xapian::docid docidByName(const std::string &pkgname) const
Retrieve a Xapian docid by package name.
Definition: textsearch.cc:181
Test basicAccess()
Definition: textsearch.test.h:84
TextSearch textsearch
Definition: textsearch.test.h:53
Definition: textsearch.test.h:48
Xapian::Database & db()
Access the Xapian database.
Definition: textsearch.h:130
Test partialOrQuery()
Definition: textsearch.test.h:118
TestTextsearch()
Definition: textsearch.test.h:55
Test empty()
Definition: textsearch.test.h:68
const Xapian::valueno VAL_APT_INSTALLED_SIZE
Definition: textsearch.h:42
size_t max_index
Definition: textsearch.cc:48
Path::OverrideIndexDir oid
Definition: textsearch.test.h:51
bool needsRebuild(apt::Apt &apt)
Returns true if the index is older than the Apt database information.
Definition: textsearch.cc:67
Definition: xapian.test.h:15