lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: Index and Field.Text
Date Fri, 05 Dec 2003 17:45:33 GMT
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:
For additional commands, e-mail:

View raw message