36 main(
int argc,
char **argv)
38 if (argc != 2 || argv[1][0] ==
'-') {
41 if (strcmp(argv[1],
"--version") == 0) {
42 cout <<
"simpleindex\n";
45 if (strcmp(argv[1],
"--help") == 0) {
49 cout <<
"Usage: " << argv[0] <<
" PATH_TO_DATABASE\n" 50 "Index each paragraph of a text file as a Xapian document.\n";
66 if (para.empty())
break;
86 if (!para.empty()) para +=
' ';
Xapian::docid add_document(const Xapian::Document &document)
Add a new document to the database.
Class representing a stemming algorithm.
void set_document(const Xapian::Document &doc)
Set the current document.
Parses a piece of text and generate terms.
void set_stemming_strategy(stem_strategy strategy)
Set the stemming strategy.
const int DB_CREATE_OR_OPEN
Create database if it doesn't already exist.
static Xapian::Stem stemmer
void index_text(const Xapian::Utf8Iterator &itor, Xapian::termcount wdf_inc=1, const std::string &prefix=std::string())
Index some text.
This class provides read/write access to a database.
Public interfaces for the Xapian library.
void set_stemmer(const Xapian::Stem &stemmer)
Set the Xapian::Stem object to be used for generating stemmed terms.
void commit()
Commit any pending modifications made to the database.
std::string get_description() const
Return a string describing this object.
All exceptions thrown by Xapian are subclasses of Xapian::Error.
int main(int argc, char **argv)
void set_data(const std::string &data)
Set data stored in the document.
A handle representing a document in a Xapian database.