lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiaozheng Ma" <Xiaozheng...@redwood.com>
Subject RE: null pointer exception when try to get contents out of hits
Date Tue, 29 Mar 2005 15:02:49 GMT
Thanks for your reply.  Actually I didn't mean to get the original
contents from the index, what I want is to get the index of the contents
(maybe in the type of Reader) so that after I put it back with the new
title, I can do the search on contents.  

You guys really have done a great job!!

Xiaozheng
> 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).

You're out of luck here.  Field.Text(String, Reader) is an unstored 
field, so the contents are not in the index.

There is one trick - you can access the terms that came from the 
analysis process over that text, but it is very unlikely to be the 
original contents.  See how Luke does this if you need to go to that 
extreme.

	Erik




---------------------------------------------------------------------
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