On Jun 23, 2005, at 6:41 AM, Ulrich Schinz wrote:
hi there!
first of all: im new here in the list, my name is uli. hello to all !
im quite new in using lucene. i created different indices, some
with GermanAnalyzer some with StandardAnalyzer...
i added Fields to my Documents with doc.add(Field.Text
("contents",new FileReader(f)); and doc.add(Field.Keyword
("filename",g.getCanonicalPath());
in the search i getresults with doc.get("filename"), where i get
the right filenames, containing search-query.
if i try to get doc.get("contents"); nothig is returned...
Field.Text(String, Reader) is not a stored field. This is why doc.get
("contents") is empty.
aim is: i wanna get the filename to generate link on top of an
result. after i'd like to have an text-snipped, where the query-term
in this document occured. just like google or some other search-
engines... i have seen this in nutch as well... so it should be
possible, but im not sure, how i can get these text-snippets...
maybe someone can give me some hints, how to manage that.
You have some options... change to using a stored field by reading
the file contents into a String and using Field.Text(String, String)
instead. Or, when rendering the results, go directly to the file
pointed to by doc.get("filename") and read its contents then. There
are pros/cons to both of these approaches.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]