本文整理汇总了C#中BytesRef.BytesEquals方法的典型用法代码示例。如果您正苦于以下问题:C# BytesRef.BytesEquals方法的具体用法?C# BytesRef.BytesEquals怎么用?C# BytesRef.BytesEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BytesRef
的用法示例。
在下文中一共展示了BytesRef.BytesEquals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SeekCeil
public override SeekStatus SeekCeil(BytesRef term)
{
if (DEBUG_SURROGATES)
{
Console.WriteLine("TE.seek target=" + UnicodeUtil.ToHexString(term.Utf8ToString()));
}
SkipNext = false;
TermInfosReader tis = OuterInstance.TermsDict;
Term t0 = new Term(fieldInfo.Name, term);
Debug.Assert(TermEnum != null);
tis.SeekEnum(TermEnum, t0, false);
Term t = TermEnum.Term();
if (t != null && t.Field() == InternedFieldName && term.BytesEquals(t.Bytes()))
{
// If we found an exact match, no need to do the
// surrogate dance
if (DEBUG_SURROGATES)
{
Console.WriteLine(" seek exact match");
}
Current = t.Bytes();
return SeekStatus.FOUND;
}
else if (t == null || t.Field() != InternedFieldName)
{
// TODO: maybe we can handle this like the next()
// into null? set term as prevTerm then dance?
if (DEBUG_SURROGATES)
{
Console.WriteLine(" seek hit EOF");
}
// We hit EOF; try end-case surrogate dance: if we
// find an E, try swapping in S, backwards:
ScratchTerm.CopyBytes(term);
Debug.Assert(ScratchTerm.Offset == 0);
for (int i = ScratchTerm.Length - 1; i >= 0; i--)
{
if (IsHighBMPChar(ScratchTerm.Bytes, i))
{
if (DEBUG_SURROGATES)
{
Console.WriteLine(" found E pos=" + i + "; try seek");
}
if (SeekToNonBMP(SeekTermEnum, ScratchTerm, i))
{
ScratchTerm.CopyBytes(SeekTermEnum.Term().Bytes());
OuterInstance.TermsDict.SeekEnum(TermEnum, SeekTermEnum.Term(), false);
NewSuffixStart = 1 + i;
DoPushes();
// Found a match
// TODO: faster seek?
Current = TermEnum.Term().Bytes();
return SeekStatus.NOT_FOUND;
}
}
}
if (DEBUG_SURROGATES)
{
Console.WriteLine(" seek END");
}
Current = null;
return SeekStatus.END;
}
else
{
// We found a non-exact but non-null term; this one
// is fun -- just treat it like next, by pretending
// requested term was prev:
PrevTerm.CopyBytes(term);
if (DEBUG_SURROGATES)
{
Console.WriteLine(" seek hit non-exact term=" + UnicodeUtil.ToHexString(t.Text()));
}
BytesRef br = t.Bytes();
Debug.Assert(br.Offset == 0);
SetNewSuffixStart(term, br);
SurrogateDance();
Term t2 = TermEnum.Term();
if (t2 == null || t2.Field() != InternedFieldName)
{
// PreFlex codec interns field names; verify:
//.........这里部分代码省略.........