Пример #1
0
        static void PrintIndexStats()
        {
            using var file = File.OpenRead(indexPath);
            var index = DictionaryIndex <int> .Deserialize(file);

            Console.WriteLine($"The: {index.Search(TextHasher.CalculateHashCode("the".AsSpan())).Count()}");
        }
Пример #2
0
        public void SerializationTest()
        {
            using var stream = new MemoryStream();

            var index = CreateIndex();

            index.Serialize(stream);

            stream.Seek(0, SeekOrigin.Begin);
            var deserializedIndex = DictionaryIndex <string> .Deserialize(stream);

            AssertIndices(index, deserializedIndex);
        }
Пример #3
0
 private ISearchableIndex <int> LoadInMemoryIndex()
 {
     using var file = IO::File.OpenRead(indexPath);
     return(DictionaryIndex <int> .Deserialize(file));
 }