Fixed requested value LVEWAvg was not found, improved resiliency

This commit is contained in:
2025-12-14 14:40:00 +01:00
parent da603746e8
commit eb6f7ef524
2 changed files with 24 additions and 16 deletions

View File

@@ -29,7 +29,7 @@ public enum ProbMethodEnum
GeometricMean,
EVEWAvg,
HVEWAvg,
LVEWavg,
LVEWAvg,
DictionaryWeightedAverage
}
@@ -49,7 +49,7 @@ public static class Probmethods
[ProbMethodEnum.GeometricMean] = GeometricMean,
[ProbMethodEnum.EVEWAvg] = ExtremeValuesEmphasisWeightedAverage,
[ProbMethodEnum.HVEWAvg] = HighValueEmphasisWeightedAverage,
[ProbMethodEnum.LVEWavg] = LowValueEmphasisWeightedAverage,
[ProbMethodEnum.LVEWAvg] = LowValueEmphasisWeightedAverage,
[ProbMethodEnum.DictionaryWeightedAverage] = DictionaryWeightedAverage
};
}
@@ -66,7 +66,6 @@ public static class Probmethods
methodName = name[..colonIndex];
jsonArg = name[(colonIndex + 1)..];
}
ProbMethodEnum probMethodEnum = (ProbMethodEnum)Enum.Parse(
typeof(ProbMethodEnum),
methodName

View File

@@ -1,5 +1,6 @@
using System.Data;
using System.Data.Common;
using ElmahCore.Mvc.Logger;
using MySql.Data.MySqlClient;
using Server.Helper;
@@ -54,7 +55,10 @@ public class Searchdomain
Dictionary<int, Dictionary<string, float[]>> embedding_unassigned = [];
while (embeddingReader.Read())
{
int id_datapoint = embeddingReader.GetInt32(1);
int id_datapoint;
try
{
id_datapoint = embeddingReader.GetInt32(1);
string model = embeddingReader.GetString(2);
long length = embeddingReader.GetBytes(3, 0, null, 0, 0);
byte[] embedding = new byte[length];
@@ -70,6 +74,11 @@ public class Searchdomain
[model] = SearchdomainHelper.FloatArrayFromBytes(embedding)
};
}
} catch (Exception e)
{
_logger.LogError("Error reading embedding (id: {id_datapoint}) from database: {e.Message} - {e.StackTrace}", [id_datapoint, e.Message, e.StackTrace]);
ElmahCore.ElmahExtensions.RaiseError(e);
}
}
embeddingReader.Close();