notmuch.git  about / heads / tags
Unnamed repository; edit this file 'description' to name the repository.
blob 8b5585676892e492df70196d9866099910347d76 653 bytes (raw)
name: ggc.cc 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
#include <xapian.h>
#include <iostream>
int main(int argc, char **argv){
  if (argc != 2) {
    fprintf (stderr, "usage: ggc xapian-database\n");
    exit (1);
  }

  Xapian::Database db(argv[1]);
  Xapian::Enquire enquire(db);

  enquire.set_query(Xapian::Query("Tghost"));

  auto mset = enquire.get_mset (0,db.get_doccount ());

  for (auto iter=mset.begin (); iter != mset.end(); iter++){
    std::string mid, tid;
    auto doc = iter.get_document ();
    auto term_iter = doc.termlist_begin ();

    term_iter.skip_to ("Q");
    mid=(*term_iter).substr(1);
    std::cout << "docid = " <<  *iter;
    std::cout << " mid " << mid << std::endl;
  }
}

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

git clone https://yhetil.org/notmuch.git