Xapian2009 code: queryparser xapian_term was refactored for the title search

We seem to have a problem in the database, please can you check this. And may be also add something similiar as a test.

   1 #!/usr/bin/env python
   2 # -*- coding: utf-8 -*-
   3 import xappy
   4 from MoinMoin.web.contexts import ScriptContext
   5 request = ScriptContext()
   6 
   7 from MoinMoin.search.Xapian import MoinSearchConnection
   8 index_dir = 'wiki/data/cache/xapian/index'
   9 conn = xappy.SearchConnection(index_dir)
  10 
  11 hits = MoinSearchConnection(conn).get_all_documents()
  12 print len(hits)

moin-1.9-xapian-dmilajevs$ ./debug_xapian1.py

gives

2009-08-09 12:09:12,178 WARNING MoinMoin.log:139 using logging configuration read from built-in fallback in MoinMoin.log module!
2009-08-09 12:09:12,451 INFO MoinMoin.config.multiconfig:127 using wiki config: /home/user/workspace/moin-1.9-xapian-dmilajevs/wikiconfig.py
Traceback (most recent call last):
  File "./debug_xapian1.py", line 11, in <module>
    hits = MoinSearchConnection(conn).get_all_documents()
  File "/home/user/workspace/moin-1.9-xapian-dmilajevs/MoinMoin/support/xappy/searchconnection.py", line 741, in __init__
    self._index = _log(_xapian.Database, indexpath)
  File "/home/user/workspace/moin-1.9-xapian-dmilajevs/MoinMoin/support/xappy/replaylog.py", line 413, in log
    return call(*args)
  File "/usr/lib/python2.6/dist-packages/xapian.py", line 2408, in __init__
    _xapian.Database_swiginit(self,_xapian.new_Database(*args))
TypeError: in method 'new_Database', argument 1 of type 'std::string const &'

replacing MoinSearchConnection(conn).get_all_documents() works

   1 document_count = conn.get_doccount()
   2 query = conn.query_all()
   3 hits = conn.search(query, 0, document_count)
   4 print len(hits)

You should pass index_dir to the MoinSearchConnection()

   1 from MoinMoin.web.contexts import ScriptContext
   2 request = ScriptContext()
   3 
   4 from MoinMoin.search.Xapian import MoinSearchConnection
   5 index_dir = 'wiki/data/cache/xapian/index'
   6 
   7 hits = MoinSearchConnection(index_dir).get_all_documents()
   8 print len(hits)

MoinMoin: Xapian2009/2009-08-07 (last edited 2009-08-09 12:44:54 by DmitriiMiliaev)