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 +=
' ';
Class representing a document.
void set_data(std::string_view data)
Set the document data.
All exceptions thrown by Xapian are subclasses of Xapian::Error.
std::string get_description() const
Return a string describing this object.
Class representing a stemming algorithm.
Parses a piece of text and generate terms.
void index_text(const Xapian::Utf8Iterator &itor, Xapian::termcount wdf_inc=1, std::string_view prefix={})
Index some text.
void set_document(const Xapian::Document &doc)
Set the current document.
void set_stemming_strategy(stem_strategy strategy)
Set the stemming strategy.
void set_stemmer(const Xapian::Stem &stemmer)
Set the Xapian::Stem object to be used for generating stemmed terms.
This class provides read/write access to a database.
void commit()
Commit pending modifications.
Xapian::docid add_document(const Xapian::Document &doc)
Add a document to the database.
const int DB_CREATE_OR_OPEN
Create database if it doesn't already exist.
int main(int argc, char **argv)
static Xapian::Stem stemmer
Public interfaces for the Xapian library.