lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Materna, Wolf-Dietrich (empolis B)" <Wolf-Dietrich.Mate...@empolis.com>
Subject AW: Why is document.get("contents")); null ?
Date Fri, 21 Feb 2003 09:03:49 GMT
Hello,
[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
indexed
and tokenized field, but only the value given as string is stored in the
index
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
document.get("contents")
shows the same behaviour while creating and searching the index.
Hope that this explanation help. Regards,
	Wolf-Dietrich

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

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


Mime
View raw message