lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Vajda <va...@apache.org>
Subject Re: Need help with TermsEnum
Date Mon, 03 Feb 2014 08:13:51 GMT

> On Feb 2, 2014, at 23:09, Premraj Narkhede <premraj.narkhede@dolcera.com> wrote:
> 
> I am using 4.5.1
> 
> 
>> On Mon, Feb 3, 2014 at 12:38 PM, Andi Vajda <vajda@apache.org> wrote:
>> 
>> 
>>>> On Feb 2, 2014, at 22:51, Premraj Narkhede <premraj.narkhede@dolcera.com>
>>> wrote:
>>> 
>>> Hi
>>> 
>>> I am trying to get to terms in Index using following code.
>>> 
>>> But I keep getting error saying termsEnum doesnt have "next" function

Try casting your termsEnum object to a BytesRefIterator via:
  BytesRefIterator.cast_(termsEnum)
then call next() on the result.
http://lucene.apache.org/core/4_5_1/core/org/apache/lucene/index/TermsEnum.html

You shouldn't have to do that, since TermsEnum implements that interface. Maybe you found
a bug. See if there is a PyLucene unit test that uses TermsEnum and how it's done there (not
near computer with code to check myself at the moment).

Andi..

>>> 
>>> Please help
>> 
>> What version of PyLucene are you using ?
>> 
>> Andi..
>> 
>>> 
>>> ireader= DirectoryReader.open(dir1)
>>> terms = SlowCompositeReaderWrapper.wrap(ireader).terms("Doc");
>>> termsEnum = terms.iterator(None)
>>> while termsEnum.next():
>>> fg=termsEnum.term()
>>> print fg
>>> 
>>> Premraj
>> 

Mime
View raw message