5 months ago
Added tag 0.8.4.1 for changeset bbc3e3a3c4fb
1 # hypy version of the estraiernative gather/search example
3 from hypy import HDatabase, HCondition
5 # open the database, read-only
6 db = HDatabase()
7 db.open('casket', 'r')
9 # create a search condition object
10 cond = HCondition(u'lull*')
12 # get the result of search
13 result = db.search(cond)
15 # iterate the result
16 for doc in result:
17 # display attributes
18 print 'URI: %s' % (doc[u'@uri'].encode('utf-8'),)
19 print "Title: %s" % (doc[u'@title'].encode('utf-8'),)
21 # display the body text
22 for t in doc.getTexts():
23 print t.encode('utf-8')
25 # close the database
26 db.close()