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';
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
double get_weight() const
Get the weight for the current position.
void set_stemmer(const Xapian::Stem &stemmer)
Set the stemmer.
ESetIterator begin() const
Return iterator pointing to the first item in this ESet.
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.
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.
Iterator over a Xapian::ESet.
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.
void add_document(Xapian::docid did)
Add a document to the relevance set.
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.
int main(int argc, char **argv)
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 list of search results.
Class representing a query.
bool empty() const
Test if this R-Set is empty.
ESetIterator end() const
Return iterator pointing to just after the last item in this ESet.