25 Jul 21:03
xapwrap to xappy migration
Hello,
I refactor Moin search code to use xappy instead of xapwrap. The first
think I tried was querying existing database using xappy. Indexing was
done by xapwrap.
Here is the code that queries the database:
#!/usr/bin/env python
import os
import re
import sys
import xappy
_whitespace_re = re.compile('\s+')
def open_index(dbpath):
return xappy.SearchConnection(dbpath)
def main(request, argv):
dbpath = os.path.join(request.cfg.cache_dir, 'xapian/index')
search = ' '.join(argv[1:])
sconn = open_index(dbpath)
print "Searching %d documents for \"%s\"" % (
sconn.get_doccount(),
search
)
q = sconn.query_parse(search, default_op=sconn.OP_AND)
print q
(Continue reading)
RSS Feed