[Xapian-discuss] Get term list from Query in python

Sungsoo Kim xingshou at gmail.com
Fri Mar 10 15:56:24 GMT 2006


I want to get term list from Query object right after qp.parse_query().
But my program written in python generates an error.
What's wrong with me? 



Sungsoo Kim


-------------------------


database = xapian.Database(db)
qp = xapian.QueryParser()
qp.set_database(database)
qp.set_default_op(xapian.Query.OP_AND)
qp.set_stemming_strategy(xapian.QueryParser.STEM_NONE)
query = qp.parse_query(input, xapian.QueryParser.FLAG_LOVEHATE)
enquire = xapian.Enquire(database)
enquire.set_query(query)
print "Performing query '%s'" % query.get_description()
for term in query: print term



$ python search.py -v cup book
Performing query 'Xapian::Query((cup:(pos=1) AND book:(pos=2)))'
Traceback (most recent call last):
  File "search.py", line 197, in ?
    main()
  File "search.py", line 191, in main
    search(string.join(args))
  File "search.py", line 77, in search
    for term in query: print term
  File "/usr/lib64/python2.3/site-packages/xapian.py", line 747, in next
    r = [self.iter.get_term(), self.iter.get_wdf(), self.iter.get_termfreq(), PositionIter(self.iter.positionlist_begin(), self.iter.positionlist_end())]
  File "/usr/lib64/python2.3/site-packages/xapian.py", line 186, in get_termfreq
    def get_termfreq(*args): return _xapian.TermIterator_get_termfreq(*args)
RuntimeError: InvalidOperationError: VectorTermList::get_termfreq() not supported
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.tartarus.org/pipermail/xapian-discuss/attachments/20060311/c5a88eef/attachment.htm


More information about the Xapian-discuss mailing list