On Mar 28, 2005, at 5:35 PM, Xiaozheng Ma wrote:

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

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



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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to