/// <summary>
/// Test field norms.
/// @lucene.experimental
/// </summary>
public static Status.FieldNormStatus TestFieldNorms(AtomicReader reader, TextWriter infoStream)
{
Status.FieldNormStatus status = new Status.FieldNormStatus();
try
{
// Test Field Norms
if (infoStream != null)
{
infoStream.Write(" test: field norms.........");
}
foreach (FieldInfo info in reader.FieldInfos)
{
if (info.HasNorms())
{
Debug.Assert(reader.HasNorms(info.Name)); // deprecated path
CheckNorms(info, reader, infoStream);
++status.TotFields;
}
else
{
Debug.Assert(!reader.HasNorms(info.Name)); // deprecated path
if (reader.GetNormValues(info.Name) != null)
{
throw new Exception("field: " + info.Name + " should omit norms but has them!");
}
}
}
Msg(infoStream, "OK [" + status.TotFields + " fields]");
}
catch (Exception e)
{
Msg(infoStream, "ERROR [" + Convert.ToString(e.Message) + "]");
status.Error = e;
if (infoStream != null)
{
// LUCENENET NOTE: Some tests rely on the error type being in
// the message. We can't get the error type with StackTrace, we
// need ToString() for that.
infoStream.WriteLine(e.ToString());
//infoStream.WriteLine(e.StackTrace);
}
}
return status;
}