lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Materna, Wolf-Dietrich (empolis B)" <>
Subject AW: Why is document.get("contents")); null ?
Date Fri, 21 Feb 2003 09:03:49 GMT
[Günter Kukies]
> Why is document.get("contents"); null ?
>  InputStreamReader input = new InputStreamReader( 
>            new ByteArrayInputStream( contents ) );
>  // Add the tag-stripped contents as a Reader-valued Text field so it will
>  // get tokenized and indexed.
>  document.add(Field.Text("contents", input ));
>  servlet.log("contents: "+ input +" doc: "+document.get("contents"));

document.get("contents") returns the value of the document field only if 
it was inserted as String, but you add it as Reader.
Note that there is difference between Field.Text(String fieldName, Reader
value )
and Field.Text(String fieldName, String value ). Both function creates an
and tokenized field, but only the value given as string is stored in the
for return with hits. Field.Text(String fieldName, Reader value ) was
designed for
indexing large documents, so it makes less sense to store this value in
index and
to access it as string. I think, it is reasonable that
shows the same behaviour while creating and searching the index.
Hope that this explanation help. Regards,

Wolf-Dietrich Materna
empolis GmbH -  arvato knowledge management 
Kekuléstr. 7 
12489 Berlin, Germany
phone :  +49-30-6780-6510
fax :    +49-30-6780-6549
<<>> <<>>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message