You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Cauvery Developer <ka...@gmail.com> on 2007/12/01 09:12:35 UTC
Document.getField(field).stringValue() behavior
Hi,
I am working with demo and I am displaying the search results as :
Hits ht = is.search(q);
for (int i = 0; i <= ht.length(); i++) {
Document hitDoc = ht.doc(i);
queryResult.add(hitDoc.getField("name").toString() + "~"
+ hitDoc.getField("date").toString());
System.out.println(queryResult) ;
}
I get the following output :
stored/uncompressed,indexed<name:HWORLD>~stored/uncompressed,indexed<date:Fri
Nov 30 23:43:50 PST 2007>
The result "HWORLD" and "Fri Nov 30 23:43:50 PST 2007" is correct. But, I
was under the impression that the output would simply be
HWORLD~Fri Nov 30 23:43:50 PST 2007
Therefore, should the output of Document.getField(field).stringValue()
behavior be further parsed to get directly to the term that was added ?
Thanks and regards,
Nags
Re: Document.getField(field).stringValue() behavior
Posted by Cauvery Developer <ka...@gmail.com>.
aaaaaaaaaaarghhhhhhh !!!!
You are right, Michael. Apologies for the stupid question.
Regards,
Nags.
On Dec 1, 2007 3:07 PM, Michael McCandless <lu...@mikemccandless.com>
wrote:
>
> If you call .stringValue() you should get just that string?
>
> (You are now calling .toString()).
>
> Mike
>
> "Cauvery Developer" <ka...@gmail.com> wrote:
> > Hi,
> > I am working with demo and I am displaying the search results as :
> >
> > Hits ht = is.search(q);
> > for (int i = 0; i <= ht.length(); i++) {
> > Document hitDoc = ht.doc(i);
> > queryResult.add(hitDoc.getField("name").toString() + "~"
> > + hitDoc.getField("date").toString());
> > System.out.println(queryResult) ;
> > }
> >
> > I get the following output :
> >
> >
> stored/uncompressed,indexed<name:HWORLD>~stored/uncompressed,indexed<date:Fri
> > Nov 30 23:43:50 PST 2007>
> >
> > The result "HWORLD" and "Fri Nov 30 23:43:50 PST 2007" is correct. But,
> I
> > was under the impression that the output would simply be
> >
> > HWORLD~Fri Nov 30 23:43:50 PST 2007
> >
> > Therefore, should the output of Document.getField(field).stringValue()
> > behavior be further parsed to get directly to the term that was added ?
> >
> > Thanks and regards,
> > Nags
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
Re: Document.getField(field).stringValue() behavior
Posted by Michael McCandless <lu...@mikemccandless.com>.
If you call .stringValue() you should get just that string?
(You are now calling .toString()).
Mike
"Cauvery Developer" <ka...@gmail.com> wrote:
> Hi,
> I am working with demo and I am displaying the search results as :
>
> Hits ht = is.search(q);
> for (int i = 0; i <= ht.length(); i++) {
> Document hitDoc = ht.doc(i);
> queryResult.add(hitDoc.getField("name").toString() + "~"
> + hitDoc.getField("date").toString());
> System.out.println(queryResult) ;
> }
>
> I get the following output :
>
> stored/uncompressed,indexed<name:HWORLD>~stored/uncompressed,indexed<date:Fri
> Nov 30 23:43:50 PST 2007>
>
> The result "HWORLD" and "Fri Nov 30 23:43:50 PST 2007" is correct. But, I
> was under the impression that the output would simply be
>
> HWORLD~Fri Nov 30 23:43:50 PST 2007
>
> Therefore, should the output of Document.getField(field).stringValue()
> behavior be further parsed to get directly to the term that was added ?
>
> Thanks and regards,
> Nags
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org