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())
This class is used to access a database, or a group of databases.
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.
This class provides an interface to the information retrieval system for the purpose of searching.
void set_query(const Xapian::Query &query, Xapian::termcount qlen=0)
Set the query to run.
ESet get_eset(Xapian::termcount maxitems, const RSet &omrset, int flags=0, const Xapian::ExpandDecider *edecider=0, double min_wt=0.0) const
Get the expand set for the given rset.
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.
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(const std::string &query_string, unsigned flags=FLAG_DEFAULT, const std::string &default_prefix=std::string())
Parse a query.
Class representing a query.
std::string get_description() const
Return a string describing this object.
void add_document(Xapian::docid did)
Add a document to the relevance set.
bool empty() const
Test if this R-Set is empty.
Class representing a stemming algorithm.
int main(int argc, char **argv)
static Xapian::Stem stemmer
Public interfaces for the Xapian library.