Tatu Saloranta wrote:
Also, shouldn't there be at least 3 methods that take Readers; one for
Text-like handling, another for UnStored, and last for UnIndexed.
How do you store the contents of a Reader? You'd have to double-buffer
it, first reading it into a String to store, and then tokenizing the
StringReader. A key feature of Reader values is that they're streamed:
the entire value is never in RAM. Storing a Reader value would remove
that advantage. The current API makes this explicit: when you want
something streamed, you pass in a Reader, when you're willing to have
the entire value in memory, pass in a String.

Yes, it is a bit confusing that Text(String, String) stores its value,
while Text(String, Reader) does not, but it is at least well documented.
And we cannot change it: that would break too many applications. But
we can put this on the list for Lucene 2.0 cleanups.

When I first wrote these static methods I meant for them to be
constructor-like. I wanted to have multiple Field(String, String)
constructors, but that's not possible, so I used capitalized static
methods instead. I've never seen anyone else do this (capitalize any
method but a real constructor) so I guess I didn't start a fad! This
should someday too be cleaned up. Lucene was the first Java program
that I ever wrote, and thus its style is in places non-standard. Sorry.


To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 7 | next ›
Discussion Overview
groupjava-user @
postedDec 5, '03 at 2:48p
activeDec 7, '03 at 11:16p



site design / logo © 2021 Grokbase