Re: PayloadAttribute behavior change between Lucene 2.9/3.0 and the trunk

2010-12-04 Thread Robert Muir
On Sat, Dec 4, 2010 at 6:05 PM, Teruhiko Kurosaka wrote: > Thank you, Robert, substituting getAttribute with addAttribute worked! > > But I don't understand why.  Could you help me to understand the mechanics? > > In my setting, > hasAttribute(PayloadAttribute.class) returns false. > > So I though

RE: PayloadAttribute behavior change between Lucene 2.9/3.0 and the trunk

2010-12-04 Thread Uwe Schindler
All tokenfilters/tokenizers in a chain share the same attributes. When you add an attribute to one of them, they all share the same instance. That's the whole trick behind the analysis API. getAttribute() should only be used in conditional code, that check with has Attribute before. But In general,

Re: PayloadAttribute behavior change between Lucene 2.9/3.0 and the trunk

2010-12-04 Thread Teruhiko Kurosaka
Thank you, Robert, substituting getAttribute with addAttribute worked! But I don't understand why. Could you help me to understand the mechanics? In my setting, hasAttribute(PayloadAttribute.class) returns false. So I thought addAttribute(PayloadAttribute.class) would just create a new PayloadA