/// <summary> Test field norms.</summary> private Status.FieldNormStatus TestFieldNorms(System.Collections.Generic.ICollection <string> fieldNames, SegmentReader reader) { Status.FieldNormStatus status = new Status.FieldNormStatus(); try { // Test Field Norms if (infoStream != null) { infoStream.Write(" test: field norms........."); } System.Collections.IEnumerator it = fieldNames.GetEnumerator(); byte[] b = new byte[reader.MaxDoc()]; while (it.MoveNext()) { System.String fieldName = (System.String)it.Current; reader.Norms(fieldName, b, 0); ++status.totFields; } Msg("OK [" + status.totFields + " fields]"); } catch (System.Exception e) { Msg("ERROR [" + System.Convert.ToString(e.Message) + "]"); status.error = e; if (infoStream != null) { infoStream.WriteLine(e.StackTrace); } } return(status); }
/// <summary> Test field norms.</summary> private Status.FieldNormStatus TestFieldNorms(ICollection <string> fieldNames, SegmentReader reader) { Status.FieldNormStatus status = new Status.FieldNormStatus(); try { // Test Field Norms if (infoStream != null) { infoStream.Write(" test: field norms........."); } byte[] b = new byte[reader.MaxDoc()]; foreach (string fieldName in fieldNames) { if (reader.HasNorms(fieldName)) { reader.Norms(fieldName, b, 0); ++status.totFields; } } Msg("OK [" + status.totFields + " fields]"); } catch (System.Exception e) { Msg("ERROR [" + System.Convert.ToString(e.Message) + "]"); status.error = e; if (infoStream != null) { infoStream.WriteLine(e.StackTrace); } } return(status); }
/// <summary> Test field norms.</summary> private Status.FieldNormStatus TestFieldNorms(IEnumerable<string> fieldNames, SegmentReader reader) { var status = new Status.FieldNormStatus(); try { // Test Field Norms if (infoStream != null) { infoStream.Write(" test: field norms........."); } var b = new byte[reader.MaxDoc]; foreach(string fieldName in fieldNames) { if (reader.HasNorms(fieldName)) { reader.Norms(fieldName, b, 0); ++status.totFields; } } Msg("OK [" + status.totFields + " fields]"); } catch (System.Exception e) { Msg("ERROR [" + System.Convert.ToString(e.Message) + "]"); status.error = e; if (infoStream != null) { infoStream.WriteLine(e.StackTrace); } } return status; }
/// <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; }
/// <summary> Test field norms.</summary> private Status.FieldNormStatus TestFieldNorms(System.Collections.Generic.ICollection<string> fieldNames, SegmentReader reader) { Status.FieldNormStatus status = new Status.FieldNormStatus(); try { // Test Field Norms if (infoStream != null) { infoStream.Write(" test: field norms........."); } System.Collections.IEnumerator it = fieldNames.GetEnumerator(); byte[] b = new byte[reader.MaxDoc()]; while (it.MoveNext()) { System.String fieldName = (System.String) it.Current; reader.Norms(fieldName, b, 0); ++status.totFields; } Msg("OK [" + status.totFields + " fields]"); } catch (System.Exception e) { Msg("ERROR [" + System.Convert.ToString(e.Message) + "]"); status.error = e; if (infoStream != null) { infoStream.WriteLine(e.StackTrace); } } return status; }