lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Palmer" <jpal...@contactnetworks.com>
Subject changes to Documents.Fields() in Lucene 1.9
Date Tue, 11 Jul 2006 17:25:29 GMT
I've just upgraded to 1.9 (congrats to everyone involved in the release)

 

I'm coming up against some issues with Document.Fields()

 

With the previous release their was a property Document.fields returning
and IList of all the fields in a given Document. This was nice because I
could do things like

 

int count = doc.fields.Count

 

 

or

 

foreach(Field field in doc.fields)

 

 

However with the removal of the fields property we now have to rely on
doc.Fields(). In 1.9 doc.Fields() is changed to return a
System.Collections.IEnumerator object which cannot be use in a foreach
loop rather than a System.Collections.IEnumerableobject. I understand
that in Java, with no foreach loops the Enumerator is about as useful as
the actual object but in.Net why does Fields() not return an object of
type System.Collections.IEnumerable. i.e. the code in Document.cs would
just be:

 

            /// <summary>Returns an Enumeration of all the fields in a
document. </summary>

            public System.Collections.IEnumerable Fields()

            {

                  return fields;

            }

 

Or maybe just 

 

            public System.Collections.IEnumerable Fields

            {

                  get

{

                        return fields;

}

            }

 

 

 

Many thanks,

Jon

 

 

            


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message