This is an automated email from the ASF dual-hosted git repository. nightowl888 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit de5251c848b79223d394778cbb17ffc1388877ba Author: Shad Storhaug <[email protected]> AuthorDate: Tue Sep 22 12:41:09 2020 +0700 Lucene.Net.Search.FieldCacheImpl: Added comments to indicate where and why we have diverged from Lucene 4.8.0 --- src/Lucene.Net/Search/FieldCacheImpl.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Lucene.Net/Search/FieldCacheImpl.cs b/src/Lucene.Net/Search/FieldCacheImpl.cs index 80749ae..26908d5 100644 --- a/src/Lucene.Net/Search/FieldCacheImpl.cs +++ b/src/Lucene.Net/Search/FieldCacheImpl.cs @@ -58,6 +58,7 @@ namespace Lucene.Net.Search /// </summary> internal class FieldCacheImpl : IFieldCache { + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable private Cache caches_typeof_sbyte; private Cache caches_typeof_short; private Cache caches_typeof_int; @@ -81,6 +82,7 @@ namespace Lucene.Net.Search { lock (this) { + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable caches_typeof_sbyte = new ByteCache(this); caches_typeof_short = new Int16Cache(this); caches_typeof_int = new Int32Cache(this); @@ -102,6 +104,7 @@ namespace Lucene.Net.Search } } + // LUCENENET specific - added GetCaches() to allow looping over the caches even though they are no longer in a collection private IEnumerable<KeyValuePair<Type, Cache>> GetCaches() { yield return new KeyValuePair<Type, Cache>(typeof(sbyte), caches_typeof_sbyte); @@ -120,6 +123,7 @@ namespace Lucene.Net.Search { lock (this) { + // LUCENENET specific - added GetCaches() to allow looping over the caches even though they are no longer in a collection foreach (var kv in GetCaches()) { kv.Value.PurgeByCacheKey(coreCacheKey); @@ -132,6 +136,7 @@ namespace Lucene.Net.Search lock (this) { IList<FieldCache.CacheEntry> result = new List<FieldCache.CacheEntry>(17); + // LUCENENET specific - added GetCaches() to allow looping over the caches even though they are no longer in a collection foreach (var cacheEntry in GetCaches()) { Cache cache = cacheEntry.Value; @@ -503,6 +508,7 @@ namespace Lucene.Net.Search { bits = docsWithField; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable caches_typeof_DocsWithFieldCache.Put(reader, new CacheKey(field, null), bits); } @@ -549,6 +555,7 @@ namespace Lucene.Net.Search { return FieldCache.Bytes.EMPTY; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable return (FieldCache.Bytes)caches_typeof_sbyte.Get(reader, new CacheKey(field, parser), setDocsWithField); } } @@ -718,6 +725,7 @@ namespace Lucene.Net.Search { return FieldCache.Int16s.EMPTY; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable return (FieldCache.Int16s)caches_typeof_short.Get(reader, new CacheKey(field, parser), setDocsWithField); } } @@ -891,6 +899,7 @@ namespace Lucene.Net.Search { return FieldCache.Int32s.EMPTY; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable return (FieldCache.Int32s)caches_typeof_int.Get(reader, new CacheKey(field, parser), setDocsWithField); } } @@ -1090,6 +1099,7 @@ namespace Lucene.Net.Search { return new Lucene.Net.Util.Bits.MatchNoBits(reader.MaxDoc); } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable return (IBits)caches_typeof_DocsWithFieldCache.Get(reader, new CacheKey(field, null), false); } @@ -1190,6 +1200,7 @@ namespace Lucene.Net.Search { return FieldCache.Singles.EMPTY; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable return (FieldCache.Singles)caches_typeof_float.Get(reader, new CacheKey(field, parser), setDocsWithField); } } @@ -1361,6 +1372,7 @@ namespace Lucene.Net.Search { return FieldCache.Int64s.EMPTY; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable return (FieldCache.Int64s)caches_typeof_long.Get(reader, new CacheKey(field, parser), setDocsWithField); } } @@ -1544,6 +1556,7 @@ namespace Lucene.Net.Search { return FieldCache.Doubles.EMPTY; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable return (FieldCache.Doubles)caches_typeof_double.Get(reader, new CacheKey(field, parser), setDocsWithField); } } @@ -1739,6 +1752,7 @@ namespace Lucene.Net.Search { return DocValues.EMPTY_SORTED; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable return (SortedDocValues)caches_typeof_SortedDocValues.Get(reader, new CacheKey(field, acceptableOverheadRatio), false); } } @@ -1905,6 +1919,7 @@ namespace Lucene.Net.Search return DocValues.EMPTY_BINARY; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable return (BinaryDocValues)caches_typeof_BinaryDocValues.Get(reader, new CacheKey(field, acceptableOverheadRatio), setDocsWithField); } @@ -2057,6 +2072,7 @@ namespace Lucene.Net.Search return DocValues.EMPTY_SORTED_SET; } + // LUCENENET specific - eliminated unnecessary Dictionary lookup by declaring each cache as a member variable DocTermOrds dto = (DocTermOrds)caches_typeof_DocTermOrds.Get(reader, new CacheKey(field, null), false); return dto.GetIterator(reader); }
