You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by jitender ahuja <aj...@aalayance.com> on 2004/04/30 11:19:20 UTC

Reader in lucene's Text Field type and in java

Hi,
       Can anyone tell if the two : Reader in lucene's as Text Field type and the Reader class in java are the same and if yes, why so?
Also, if they are the same then does one must take the data input(even if from a XML Document from a database) from a Reader class or its relevant subclass. 
Regards,
Jitender

Re: Reader in lucene's Text Field type and in java

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Apr 30, 2004, at 5:19 AM, jitender ahuja wrote:
> Hi,
>        Can anyone tell if the two : Reader in lucene's as Text Field 
> type and the Reader class in java are the same and if yes, why so?
> Also, if they are the same then does one must take the data input(even 
> if from a XML Document from a database) from a Reader class or its 
> relevant subclass.

The Text field also takes a String in an overloaded signature.

Yes, Reader is a java.io.Reader.  Why?  I guess my question is "why 
not?".

So yes, you must feed text into Lucene either as a String or, if the 
Text field w/ Reader fits what you want that field to do, with a 
Reader.  Keep in mind that using Field.Text with a Reader is a slightly 
different than Field.Text with a String.  The Reader one does _not_ 
store the contents in the index - it indexes and tokenizes, but does 
not store.  The reasoning, I presume, for this is that text coming from 
a Reader is going to be larger than just a String and you would likely 
not want to store it anyway.

	Erik


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