本文整理汇总了C#中Lucene.Net.Index.IndexReader.HasNorms方法的典型用法代码示例。如果您正苦于以下问题:C# IndexReader.HasNorms方法的具体用法?C# IndexReader.HasNorms怎么用?C# IndexReader.HasNorms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Index.IndexReader
的用法示例。
在下文中一共展示了IndexReader.HasNorms方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckNorms
public static void CheckNorms(IndexReader reader)
{
// test omit norms
for (int i = 0; i < DocHelper.fields.Length; i++)
{
Fieldable f = DocHelper.fields[i];
if (f.IsIndexed())
{
Assert.AreEqual(reader.HasNorms(f.Name()), !f.GetOmitNorms());
Assert.AreEqual(reader.HasNorms(f.Name()), !DocHelper.noNorms.Contains(f.Name()));
if (!reader.HasNorms(f.Name()))
{
// test for fake norms of 1.0 or null depending on the flag
byte[] norms = reader.Norms(f.Name());
byte norm1 = DefaultSimilarity.EncodeNorm(1.0f);
if (reader.GetDisableFakeNorms())
Assert.IsNull(norms);
else
{
Assert.AreEqual(norms.Length, reader.MaxDoc());
for (int j = 0; j < reader.MaxDoc(); j++)
{
Assert.AreEqual(norms[j], norm1);
}
}
norms = new byte[reader.MaxDoc()];
reader.Norms(f.Name(), norms, 0);
for (int j = 0; j < reader.MaxDoc(); j++)
{
Assert.AreEqual(norms[j], norm1);
}
}
}
}
}
示例2: AddIndexed
private void AddIndexed(IndexReader reader, FieldInfos fInfos, System.Collections.Generic.ICollection<string> names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool storePayloads, bool omitTFAndPositions)
{
System.Collections.Generic.IEnumerator<string> i = names.GetEnumerator();
while (i.MoveNext())
{
System.String field = i.Current;
fInfos.Add(field, true, storeTermVectors, storePositionWithTermVector, storeOffsetWithTermVector, !reader.HasNorms(field), storePayloads, omitTFAndPositions);
}
}
示例3: AddIndexed
private void AddIndexed(IndexReader reader, FieldInfos fieldInfos, System.Collections.ICollection names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
{
System.Collections.IEnumerator i = names.GetEnumerator();
while (i.MoveNext())
{
System.Collections.DictionaryEntry e = (System.Collections.DictionaryEntry) i.Current;
System.String field = (System.String) e.Key;
fieldInfos.Add(field, true, storeTermVectors, storePositionWithTermVector, storeOffsetWithTermVector, !reader.HasNorms(field));
}
}
示例4: AddIndexed
private void AddIndexed(IndexReader reader, FieldInfos fInfos, ICollection<string> names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool storePayloads, bool omitTFAndPositions)
{
foreach (var field in names)
{
fInfos.Add(field, true, storeTermVectors, storePositionWithTermVector, storeOffsetWithTermVector,
!reader.HasNorms(field), storePayloads, omitTFAndPositions);
}
}
示例5: CheckNorms
public static void CheckNorms(IndexReader reader)
{
// test omit norms
for (int i = 0; i < DocHelper.fields.Length; i++)
{
Lucene.Net.Documents.Fieldable f = DocHelper.fields[i];
if (f.IsIndexed())
{
Assert.AreEqual(reader.HasNorms(f.Name()), !f.GetOmitNorms());
Assert.AreEqual(reader.HasNorms(f.Name()), !DocHelper.noNorms.Contains(f.Name()));
if (!reader.HasNorms(f.Name()))
{
// test for fake norms of 1.0
byte[] norms = reader.Norms(f.Name());
Assert.AreEqual(norms.Length, reader.MaxDoc());
for (int j = 0; j < reader.MaxDoc(); j++)
{
Assert.AreEqual(norms[j], DefaultSimilarity.EncodeNorm(1.0f));
}
norms = new byte[reader.MaxDoc()];
reader.Norms(f.Name(), norms, 0);
for (int j = 0; j < reader.MaxDoc(); j++)
{
Assert.AreEqual(norms[j], DefaultSimilarity.EncodeNorm(1.0f));
}
}
}
}
}