NightOwl888 commented on code in PR #1058:
URL: https://github.com/apache/lucenenet/pull/1058#discussion_r1997476066
##########
src/Lucene.Net.Memory/MemoryIndex.cs:
##########
@@ -275,23 +284,45 @@ public virtual TokenStream
KeywordTokenStream<T>(ICollection<T> keywords)
return new TokenStreamAnonymousClass<T>(keywords);
}
+ /// <summary>
+ /// An anonymous implementation of <see cref="TokenStream"/> for
+ /// <see cref="KeywordTokenStream{T}(ICollection{T})"/>.
+ /// </summary>
+ /// <typeparam name="T">The type of item in the collection.</typeparam>
+ /// <remarks>
+ /// LUCENENET specific - This class originally got an enumerator in
the constructor and stored it to a field
+ /// that was never reset, which meant that it could not be reused
(since most IEnumerator implementations can
+ /// only be iterated once and throw on <see
cref="System.Collections.IEnumerator.Reset()"/>). This class has
Review Comment:
Good points. I wish Microsoft made an `IResettable` so detection would be
easy.
Given that this is a small single instance rather than an array and Lucene
didn't even think to make it reusable in the first place, I think we can leave
this as-is (although, let's fix the comments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]