lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiaozheng Ma" <Xiaozheng...@redwood.com>
Subject null pointer exception when try to get contents out of hits
Date Mon, 28 Mar 2005 22:35:05 GMT

Hi guys,

I indexed the file by title and contents such as:
   document.add(Field.Text("title", file.getTitle()));
   document.add(Field.Text("contents", file.getTextContents())); 
	//the getTextContents() return the Reader type obj

so far so good. I was able to search on both title and contents.

Now since the title changed, I need to update the index(the contents
never change). Instead of calling file.getTextContents() again, I figure
that it maybe faster if I can get the reader (of contents field) back
from the search hits(the original file could be huge).

  While <hits.doc(0).get("title")> returns title as expected
 
BUT the call on 'contents' returns null and raises null pointer
exception on further action.
Both 
	hits.doc(0).get("contents") 
AND
	hits.doc(0).getField("contents")
return null

I tested that I could search on 'contents:something' and it returned the
expected hit.

I am using the Lucene one release before the current release. My
question is: is it possible to get the Reader object (or contents text
string in that matter) back after I get the hit and how.

Thank you in advance!

Xiaozheng

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


Mime
View raw message