lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENENET-97) HitIterator does not correctly implement System.Collections.IEnumerator
Date Wed, 29 Aug 2007 22:06:38 GMT

    [ https://issues.apache.org/jira/browse/LUCENENET-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523714
] 

Digy commented on LUCENENET-97:
-------------------------------

General usage of HitIterator is:

            HitIterator iterator = (HitIterator)hits.Iterator();
            MessageBox.Show(iterator.Length().ToString()); 
            while (iterator.MoveNext())
            {
                Hit h = (Hit)iterator.Current;
                MessageBox.Show(h.Get("field"));

                iterator.MoveNext();
            }


The position increment is done in "Current" property. "MoveNext" method is just to see whether
there is another item in the list or not. 
So 
iterator.MoveNext(); // position to 1st hit
iterator.MoveNext(); // position to 2nd hit 
does not anything other than to check the end of the list and ignoring the results.

(I aggree, methods names can be confusing)

DIGY






> HitIterator does not correctly implement System.Collections.IEnumerator
> -----------------------------------------------------------------------
>
>                 Key: LUCENENET-97
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-97
>             Project: Lucene.Net
>          Issue Type: Bug
>         Environment: .NET
>            Reporter: Neal Granroth
>
> method MoveNext() is supposed to increment the position within the list; it does not.
> method Current() is supposed to return the object at the current position, but not change
the position within the list.
> It incorrectly moves to the next position.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message