Skip to content

Commit 8821689

Browse files
committed
Optimize dictionary loading: skip unused handle with Stream.Seek
1 parent 2fc4987 commit 8821689

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Lucene.Net.Analysis.SmartCn/Hhmm/BigramDictionary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public virtual void LoadFromFile(string dctFilePath)
306306
// LUCENENET: Use BinaryReader to decode little endian instead of ByteBuffer, since this is the default in .NET
307307
buffer[0] = reader.ReadInt32(); // frequency
308308
buffer[1] = reader.ReadInt32(); // length
309-
buffer[2] = reader.ReadInt32(); // Skip handle value (unused)
309+
reader.BaseStream.Seek(4, SeekOrigin.Current); // Skip handle value (unused)
310310

311311
length = buffer[1];
312312
if (length > 0 && dctFile.Position + length <= dctFile.Length)

src/Lucene.Net.Analysis.SmartCn/Hhmm/WordDictionary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ private int LoadMainDataFromFile(string dctFilePath)
385385
// LUCENENET: Use BinaryReader to decode little endian instead of ByteBuffer, since this is the default in .NET
386386
buffer[0] = reader.ReadInt32(); // frequency
387387
buffer[1] = reader.ReadInt32(); // length
388-
buffer[2] = reader.ReadInt32(); // handle
388+
reader.BaseStream.Seek(4, SeekOrigin.Current); // Skip handle value (unused)
389389

390390
// wordItemTable[i][j].frequency = buffer[0];
391391

0 commit comments

Comments
 (0)