Merge pull request #25 from LD-Reborn/23-bug-requested-value-lvewavg-was-not-found
Fixed requested value LVEWAvg was not found, improved resiliency
This commit is contained in:
@@ -29,7 +29,7 @@ public enum ProbMethodEnum
|
|||||||
GeometricMean,
|
GeometricMean,
|
||||||
EVEWAvg,
|
EVEWAvg,
|
||||||
HVEWAvg,
|
HVEWAvg,
|
||||||
LVEWavg,
|
LVEWAvg,
|
||||||
DictionaryWeightedAverage
|
DictionaryWeightedAverage
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public static class Probmethods
|
|||||||
[ProbMethodEnum.GeometricMean] = GeometricMean,
|
[ProbMethodEnum.GeometricMean] = GeometricMean,
|
||||||
[ProbMethodEnum.EVEWAvg] = ExtremeValuesEmphasisWeightedAverage,
|
[ProbMethodEnum.EVEWAvg] = ExtremeValuesEmphasisWeightedAverage,
|
||||||
[ProbMethodEnum.HVEWAvg] = HighValueEmphasisWeightedAverage,
|
[ProbMethodEnum.HVEWAvg] = HighValueEmphasisWeightedAverage,
|
||||||
[ProbMethodEnum.LVEWavg] = LowValueEmphasisWeightedAverage,
|
[ProbMethodEnum.LVEWAvg] = LowValueEmphasisWeightedAverage,
|
||||||
[ProbMethodEnum.DictionaryWeightedAverage] = DictionaryWeightedAverage
|
[ProbMethodEnum.DictionaryWeightedAverage] = DictionaryWeightedAverage
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,6 @@ public static class Probmethods
|
|||||||
methodName = name[..colonIndex];
|
methodName = name[..colonIndex];
|
||||||
jsonArg = name[(colonIndex + 1)..];
|
jsonArg = name[(colonIndex + 1)..];
|
||||||
}
|
}
|
||||||
|
|
||||||
ProbMethodEnum probMethodEnum = (ProbMethodEnum)Enum.Parse(
|
ProbMethodEnum probMethodEnum = (ProbMethodEnum)Enum.Parse(
|
||||||
typeof(ProbMethodEnum),
|
typeof(ProbMethodEnum),
|
||||||
methodName
|
methodName
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
|
using ElmahCore.Mvc.Logger;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using Server.Helper;
|
using Server.Helper;
|
||||||
|
|
||||||
@@ -54,7 +55,10 @@ public class Searchdomain
|
|||||||
Dictionary<int, Dictionary<string, float[]>> embedding_unassigned = [];
|
Dictionary<int, Dictionary<string, float[]>> embedding_unassigned = [];
|
||||||
while (embeddingReader.Read())
|
while (embeddingReader.Read())
|
||||||
{
|
{
|
||||||
int id_datapoint = embeddingReader.GetInt32(1);
|
int id_datapoint;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
id_datapoint = embeddingReader.GetInt32(1);
|
||||||
string model = embeddingReader.GetString(2);
|
string model = embeddingReader.GetString(2);
|
||||||
long length = embeddingReader.GetBytes(3, 0, null, 0, 0);
|
long length = embeddingReader.GetBytes(3, 0, null, 0, 0);
|
||||||
byte[] embedding = new byte[length];
|
byte[] embedding = new byte[length];
|
||||||
@@ -70,6 +74,11 @@ public class Searchdomain
|
|||||||
[model] = SearchdomainHelper.FloatArrayFromBytes(embedding)
|
[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();
|
embeddingReader.Close();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user