lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ambiese...@gmx.de
Subject Re: Retrieving the content from hits...
Date Mon, 05 Jan 2004 18:47:58 GMT
Hi,

thank you for this advice. I guess the usual way of searching and retrieving
the document is to search like I did (with the reduced info in the index
(only cleaned text)) and later load the file with the "filename" information. I
just realised that no example for this simple task is actually available. 

Cheers,
Ralf

> Actually, creating a Field with a Reader means the field data is 
> "unstored".  It is indexed, but the original text is not retrievable as 
> 
> it is not in the index (yes, it is tokenized, but not kept as a unit, 
> and is very unlikely to be the same as the original text)
> 
> If you need the text to be stored in the index, read the text into a 
> String and use that Field.Text variant rather than a Reader.
> 
> 	Erik
> 
> 
> On Jan 5, 2004, at 11:35 AM, Grant Ingersoll wrote:
> 
> > I believe since you created the field using a Reader, you have to use 
> 
> > the Field.readerValue() method instead of the stringValue() method and 
> 
> > then handle the reader appropriately.  I don't know if there is anyway 
> 
> > to determine which one is used for a given field other than to test 
> > for null on the readerValue()?????
> >
> > -Grant
> >
> >>>> ambiesense@gmx.de 01/05/04 11:27AM >>>
> > Hi Group,
> >
> > I have a little problem which is able of being solved easily from the
> > expertise within this group.
> >
> > A index has beein generated. The document used looks like this:
> >
> > Document doc = new Document();
> > doc.add(Field.Text("contents", new FileReader(file)));
> > doc.add(Field.Keyword("filename", file.getCanonicalPath()));
> >
> >
> > When I now search, I get a correct hit. However it seems the 
> "contents"
> > field does not exist. When I get the field, only "filename" exists...
> >
> > Here some code how I parse the hits object:
> >
> > Document d = hits.doc(0);
> > Enumeration enum = d.fields();
> > while (enum.hasMoreElements()){
> >   Field f = (Field)enum.nextElement();
> >   System.out.println("Field value = " + f.stringValue());
> > }
> >
> > Where is the problem?
> >
> > Ralf
> >
> >
> > -- 
> > +++ GMX - die erste Adresse für Mail, Message, More +++
> > Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 

-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net



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