#!/usr/bin/env python # vim: fileencoding=utf-8 """ simplest implementation of a searcher """ import HyperEstraier # open the database db = HyperEstraier.Database() db.open('casket', HyperEstraier.Database.DBREADER) # create a search condition object cond = HyperEstraier.Condition() # set the search phrase to the search condition object cond.set_phrase('somewhere') # get the result of search result = db.search(cond, 0) # for each document in result <<<<<<< search.py doc = result.next() while doc: print doc.get_id() ======= for i in result: print "id = ", i # get the document doc = db.get_doc(i, 0) >>>>>>> 1.10 # display attributes for attr_name in doc.attr_names(): print "%s : %s" % (attr_name, doc.attr(attr_name)) # display the body text print doc.cat_texts() # etch for key, val in db.etch_doc(doc, 10).items(): print "%s : %s" % (key, val) sv = HyperEstraier.StrVector() sv.push_back('somewhere') sv.push_back('rainbow') print doc.make_snippet(sv, 100, 100, 100) sv.pop_back() sv.push_back('health')