lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Palmer (JIRA)" <>
Subject [jira] Commented: (LUCENENET-97) HitIterator does not correctly implement System.Collections.IEnumerator
Date Thu, 30 Aug 2007 01:46:30 GMT


Jon Palmer commented on LUCENENET-97:

Agreeded, next and hasNext is at least clear whats going on.

[ Show ยป ] Digy - 29/Aug/07 06:15 PM PS: "Implementing IEnumerator correctly" contradicts
with the logic of Hits class. It doesn't not return all the results at onces considering the
performance issues. The existance of HitIterator class(even in Lucene java) is because of

Not sure what you mean by this. Implementing IEnumerator implies nothing about getting all
the resutls at once. In fact quite the opposite it says the results will be enumerated. There
are loads of classes in the .net apis that use Ienumerator interface but aren't necessarily
getting all results at once, DataTable.Rows for example.

If the Hits class was to implement IEnumerable you might use it like this:

foreach (Hit h in hits)
    if (haveEnoughResultsCondition)

The entire point of the IEnumerator interface is that it lets implemeting class worry about
the performnace issues. The particular class might get all the results at once, get them in
a paged fashion as needed or, as in the hits collection, get them one at a time on each call
to hits.MoveNext() (which gets implicitly called by .net when you use the foreach loop).


> HitIterator does not correctly implement System.Collections.IEnumerator
> -----------------------------------------------------------------------
>                 Key: LUCENENET-97
>                 URL:
>             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.

View raw message