Hello again,
I’m honest: I’m a bit frustrated by the amount of bugs we are experiencing with GroupDocs.Search. ![]()
I just wanted to verify OverflowException: Arithmetic operation resulted in an overflow - #13 by jamsharp (have not been able to do so yet).
I read that the index structure got a breaking change, so I followed the steps here to test the migration for a random 6 GB index on my PC: Update index | GroupDocs
Result: Executing the code destroys the index. After executing it, its size shrinks from 6GB to 2MB and according to the GroupDocs classes, there are then 0 documents in it. It does not matter whether original index path and migrated index path are identical or not. No exception or anything. It takes 25 seconds and then, the index is gone.
This was our test code by the way:
static int MigrateIndex(string sourceIndexFolder, string targetIndexFolder)
{
if (!Directory.Exists(sourceIndexFolder))
{
Console.WriteLine($"Source index folder '{sourceIndexFolder}' does not exist.");
return 1;
}
Console.WriteLine("Initializing license...");
new License().SetLicense("license.lic");
Console.WriteLine("Initialized license...");
var updater = new IndexUpdater();
// Logging number of documents before migration does not work, because version does not match.
if (!updater.CanUpdateVersion(sourceIndexFolder))
{
Console.WriteLine(updater.IsLatestVersion(sourceIndexFolder)
? "The source index is already at the latest version. No migration necessary."
: "The source index version is not supported for migration.");
return 0;
}
Console.WriteLine($"Migrating index from '{sourceIndexFolder}' to '{targetIndexFolder}'...");
var stopwatch = Stopwatch.StartNew();
var result = updater.UpdateVersion(sourceIndexFolder, targetIndexFolder);
stopwatch.Stop();
Console.WriteLine($"Migration took {stopwatch.Elapsed}.");
LogDocumentCount("Target index (after migration)", targetIndexFolder);
Console.WriteLine(result switch
{
VersionUpdateResult.Updated => "Index migrated successfully.",
VersionUpdateResult.AlreadyUpToDate => "The source index was already at the latest version.",
VersionUpdateResult.Unsupported => "The source index version is not supported for migration.",
_ => $"Unknown migration result: {result}",
});
return result == VersionUpdateResult.Unsupported ? 1 : 0;
}
static void LogDocumentCount(string description, string indexFolder)
{
try
{
using var index = new GroupDocs.Search.Index(indexFolder);
Console.WriteLine($"{description}: {index.GetIndexedDocuments().Length} document(s).");
}
catch (Exception exception)
{
Console.WriteLine($"{description}: could not determine document count ({exception.Message}).");
}
}