38 main(
int argc,
char **argv)
44 if (strcmp(argv[1],
"--version") == 0) {
45 cout <<
"simplesearch\n";
48 if (strcmp(argv[1],
"--help") == 0) {
52 cout <<
"Usage: " << argv[0] <<
" PATH_TO_DATABASE QUERY\n";
65 string query_string(argv[2]);
69 query_string += *argv++;
87 cout <<
"Matches 1-" << matches.
size() <<
":\n\n";
90 cout << i.get_rank() + 1 <<
": " << i.get_weight() <<
" docid=" << *i
91 <<
" [" << i.get_document().get_data() <<
"]\n\n";
Xapian::doccount size() const
Return number of items in this MSet object.
This class is used to access a database, or a group of databases.
Class representing a stemming algorithm.
Build a Xapian::Query object from a user query string.
Class representing a list of search results.
MSet get_mset(Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount checkatleast=0, const RSet *omrset=0, const MatchDecider *mdecider=0) const
Get (a portion of) the match set for the current query.
static Xapian::Stem stemmer
void set_stemmer(const Xapian::Stem &stemmer)
Set the stemmer.
void set_stemming_strategy(stem_strategy strategy)
Set the stemming strategy.
Iterator over a Xapian::MSet.
Public interfaces for the Xapian library.
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.
Query parse_query(const std::string &query_string, unsigned flags=FLAG_DEFAULT, const std::string &default_prefix=std::string())
Parse a query.
void set_query(const Xapian::Query &query, Xapian::termcount qlen=0)
Set the query to run.
std::string get_description() const
Return a string describing this object.
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())
Xapian::doccount get_matches_estimated() const
Estimate of the total number of matching documents.
void set_database(const Database &db)
Specify the database being searched.
std::string get_description() const
Return a string describing this object.
This class provides an interface to the information retrieval system for the purpose of searching...
All exceptions thrown by Xapian are subclasses of Xapian::Error.
Class representing a query.
int main(int argc, char **argv)