You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by ro...@xemaps.com on 2002/11/13 15:58:37 UTC

the order of fields in Document.fields()

Quick question about Document.fields().

Lucene provides you with a method to retrieve the value of a field or grab
all fields as an Enumeration.  It does not, however, allow you to grab all
values of one field for a document, it will only return the last value added
for that field.  

For example, I am indexing email messages that might have multiple To/CC/BCC
fields in the message header.  Currently to grab all the values when I
display an email that has been indexed, I must use the fields() method to
grab an Enumeration of all fields in a document.  I then separate them into
different arrays based on the field names.  However I am concerned about the
order of the fields since I consider the first To or CC or BCC to be the
main value for each field.  

Is the order of the fields returned in the order that they are added?  Or is
there no order?  If there is no order, can someone suggest a solution?

Thanks!

Roy.


This email and any attachments are confidential and may be 
legally privileged. No confidentiality or privilege is waived 
or lost by any transmission in error.  If you are not the 
intended recipient you are hereby notified that any use, 
printing, copying or disclosure is strictly prohibited.  
Please delete this email and any attachments, without 
printing, copying, forwarding or saving them and notify the 
sender immediately by reply e-mail.  Zurich Capital Markets 
and its affiliates reserve the right to monitor all e-mail 
communications through its networks.  Unless otherwise 
stated, any pricing information in this e-mail is indicative 
only, is subject to change and does not constitute an offer 
to enter into any transaction at such price and any terms in 
relation to any proposed transaction are indicative only and 
subject to express final confirmation.

Re: the order of fields in Document.fields()

Posted by Otis Gospodnetic <ot...@yahoo.com>.
The order is preserved (or reversed actually), so it's not random.
It's reverse of the order of the order in which the fields were added
to the document.

This would be easy to test...

Otis

--- roy-lucene-user@xemaps.com wrote:
> Quick question about Document.fields().
> 
> Lucene provides you with a method to retrieve the value of a field or
> grab
> all fields as an Enumeration.  It does not, however, allow you to
> grab all
> values of one field for a document, it will only return the last
> value added
> for that field.  
> 
> For example, I am indexing email messages that might have multiple
> To/CC/BCC
> fields in the message header.  Currently to grab all the values when
> I
> display an email that has been indexed, I must use the fields()
> method to
> grab an Enumeration of all fields in a document.  I then separate
> them into
> different arrays based on the field names.  However I am concerned
> about the
> order of the fields since I consider the first To or CC or BCC to be
> the
> main value for each field.  
> 
> Is the order of the fields returned in the order that they are added?
>  Or is
> there no order?  If there is no order, can someone suggest a
> solution?
> 
> Thanks!
> 
> Roy.
> 
> 
> This email and any attachments are confidential and may be 
> legally privileged. No confidentiality or privilege is waived 
> or lost by any transmission in error.  If you are not the 
> intended recipient you are hereby notified that any use, 
> printing, copying or disclosure is strictly prohibited.  
> Please delete this email and any attachments, without 
> printing, copying, forwarding or saving them and notify the 
> sender immediately by reply e-mail.  Zurich Capital Markets 
> and its affiliates reserve the right to monitor all e-mail 
> communications through its networks.  Unless otherwise 
> stated, any pricing information in this e-mail is indicative 
> only, is subject to change and does not constitute an offer 
> to enter into any transaction at such price and any terms in 
> relation to any proposed transaction are indicative only and 
> subject to express final confirmation.
> 


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>