Groups2009: some code refinements, get_Val macro do not throw an error if dictionary is not defined

Xapian2009: querying existing index made by xapwrap

I was trying to get some documents using xappy in index build with

MoinMoin/script/moin.py index build --mode=add

   1 import xappy
   2 
   3 index_dir = 'wiki/data/cache/xapian/index'
   4 conn = xappy.SearchConnection(index_dir)
   5 
   6 q = conn.query_field('content', 'moin')
   7 str(q)
   8 
   9 results = conn.search(q, 0, 10)
  10 results

>>> import xappy
>>> 
>>> index_dir = 'wiki/data/cache/xapian/index'
>>> conn = xappy.SearchConnection(index_dir)
>>> 
>>> q = conn.query_field('content', 'moin')
>>> str(q)
'Xapian::Query()'
>>> 
>>> results = conn.search(q, 0, 10)
>>> results
<SearchResults(startrank=0, endrank=0, more_matches=False, matches_lower_bound=0, matches_upper_bound=0, matches_estimated=0, estimate_is_exact=True)>

Currently, I do not understand, why query is qmpty ('Xapian::Query()'). May be i query frong field ( currently i query content)

read access to xapian.Index indexValueMap

   1 indexValueMap = {
   2         # mapping the value names we can easily fetch from the index to
   3         # integers required by xapian. 0 and 1 are reserved by xapwrap!
   4         'pagename': 2,
   5         'attachment': 3,
   6         'mtime': 4,
   7         'wikiname': 5,
   8         'revision': 6,
   9     }

   1 import xappy, os
   2 from MoinMoin.web.contexts import ScriptContext
   3 request = ScriptContext()
   4 
   5 dbpath = os.path.join(request.cfg.cache_dir, 'xapian/index')
   6 sconn =  xappy.SearchConnection(dbpath)
   7 
   8 index = sconn._index
   9 text = index.get_document(2)
  10 print text.get_value(2)

'FortuneCookies'

Term Prefixes

http://xapian.org/docs/omega/termprefixes.html

MoinMoin: Xapian2009/2009-07-24 (last edited 2009-07-26 16:26:42 by ReimarBauer)