当前位置: 首页>>代码示例>>C#>>正文


C# BytesRef.BytesEquals方法代码示例

本文整理汇总了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:
//.........这里部分代码省略.........
开发者ID:paulirwin,项目名称:lucene.net,代码行数:101,代码来源:Lucene3xFields.cs


注:本文中的BytesRef.BytesEquals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。