36 main(
int argc,
char **argv)
42 if (strcmp(argv[1],
"--version") == 0) {
43 cout <<
"simpleexpand\n";
46 if (strcmp(argv[1],
"--help") == 0) {
50 cout <<
"Usage: " << argv[0] <<
" PATH_TO_DATABASE QUERY [-- [DOCID...]]\n";
63 string query_string(argv[2]);
65 while (*argv && strcmp(*argv,
"--") != 0) {
67 query_string += *argv++;
95 cout << i.get_rank() + 1 <<
": " << i.get_weight() <<
" docid=" << *i
96 <<
" [" << i.get_document().get_data() <<
"]\n\n";
104 while (c-- && i != matches.
end()) {
116 for (t = eset.
begin(); t != eset.
end(); ++t) {
117 cout << *t <<
": weight = " << t.
get_weight() <<
'\n';
static Xapian::Query query(Xapian::Query::op op, const string &t1=string(), const string &t2=string(), const string &t3=string(), const string &t4=string(), const string &t5=string(), const string &t6=string(), const string &t7=string(), const string &t8=string(), const string &t9=string(), const string &t10=string())
An indexed database of documents.
Iterator over a Xapian::ESet.
double get_weight() const
Get the weight for the current position.
Class representing a list of search results.
ESetIterator end() const
Return iterator pointing to just after the last item in this ESet.
ESetIterator begin() const
Return iterator pointing to the first item in this ESet.
MSet get_mset(doccount first, doccount maxitems, doccount checkatleast=0, const RSet *rset=NULL, const MatchDecider *mdecider=NULL) const
Run the query.
void set_query(const Query &query, termcount query_length=0)
Set the query.
ESet get_eset(termcount maxitems, const RSet &rset, int flags=0, const ExpandDecider *edecider=NULL, double min_weight=0.0) const
Perform query expansion.
All exceptions thrown by Xapian are subclasses of Xapian::Error.
std::string get_description() const
Return a string describing this object.
Iterator over a Xapian::MSet.
Class representing a list of search results.
MSetIterator begin() const
Return iterator pointing to the first item in this MSet.
MSetIterator end() const
Return iterator pointing to just after the last item in this MSet.
Xapian::doccount get_matches_estimated() const
Estimate of the total number of matching documents.
Build a Xapian::Query object from a user query string.
void set_database(const Database &db)
Specify the database being searched.
void set_stemmer(const Xapian::Stem &stemmer)
Set the stemmer.
void set_stemming_strategy(stem_strategy strategy)
Set the stemming strategy.
Query parse_query(std::string_view query_string, unsigned flags=FLAG_DEFAULT, std::string_view default_prefix={})
Parse a query.
Class representing a query.
std::string get_description() const
Return a string describing this object.
Class representing a set of documents judged as relevant.
void add_document(Xapian::docid did)
Mark a document as relevant.
bool empty() const
Return true if this RSet object is empty.
Class representing a stemming algorithm.
int main(int argc, char **argv)
static Xapian::Stem stemmer
Public interfaces for the Xapian library.