xapian-core  2.0.0
xapianjstest.cc
Go to the documentation of this file.
1 
4 #include <emscripten.h>
5 #include <xapian.h>
6 #include <iostream>
7 
8 using namespace std;
9 
10 int main() {
11 #ifdef NODEFS
12  EM_ASM({
13  FS.mkdir("/work");
14  FS.mount(NODEFS, {root: '.'},"/work");
15  FS.chdir("/work");
16  });
17 #endif
18 
20 
21  Xapian::TermGenerator termgenerator;
22  Xapian::Document doc;
23  termgenerator.set_document(doc);
24  termgenerator.index_text("This is a test document.");
25  db.replace_document("Q1", doc);
26 
27  cout << "Created database with " << db.get_doccount()
28  << " documents" << endl;
29 }
Class representing a document.
Definition: document.h:64
Parses a piece of text and generate terms.
Definition: termgenerator.h:49
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.
This class provides read/write access to a database.
Definition: database.h:964
const int DB_CREATE_OR_OPEN
Create database if it doesn't already exist.
Definition: constants.h:34
Public interfaces for the Xapian library.
int main()
Definition: xapianjstest.cc:10