On Thu, Nov 11, 2010 at 1:25 PM, Burton-West, Tom <tburt...@umich.edu> wrote:
> I do need to port my filter to lucene 3.x, so is there 3.x documentation 
> about use of CharTermAttributeImpl?
>
> Is this something that needs to be in the TokenStream examples in the 3.0.2 
> org.apache.lucene.analysis package.html?

No, it is still unreleased, but is in the 3.x branch for what is
scheduled to be the 3.1 release.
So its not relevant to 3.0.2, it does not exist there.

Additionally, even in 3.1 when this is released, your old
TermAttribute code will continue to work transparently. Some
tokenstreams can use CharTermAttribute and some can use TermAttribute
interchangeably so you can upgrade at your leisure...

The examples in 3.1 are changed to the new CharTermAttribute. its
pretty trivial to upgrade if you don't need to take advantage of its
new capabilities, mostly simple stuff like changing .setTermLength()
to .setLength(), etc.


If you want to use the new capabilities, they are that
CharTermAttribute implements CharSequence and Appendable. This means
for example its more easy to integrate with libraries (including java
itself) that support these interfaces.

For example: you can look at PatternReplaceFilter, in its ctor it just
does Matcher matcher = pattern.matcher(charTermAtt).
Then in its incrementToken, it can just call matcher.reset() and
matcher.find() etc directly on the reusable attribute.

Bottom line: with the way it is now, you don't have to change any code
until lucene 4.0 unless you want to, and can keep using TermAttribute
if you are happy with it.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to