本文整理汇总了C#中Term.Bytes方法的典型用法代码示例。如果您正苦于以下问题:C# Term.Bytes方法的具体用法?C# Term.Bytes怎么用?C# Term.Bytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term.Bytes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Set
public void Set(Term term)
{
if (term == null)
{
Reset();
return;
}
Bytes.CopyBytes(term.Bytes());
Field = String.Intern(term.Field());
CurrentFieldNumber = -1;
this.Term = term;
}
示例2: DeepCopyOf
internal static Term DeepCopyOf(Term other)
{
return new Term(other.Field(), BytesRef.DeepCopyOf(other.Bytes()));
}
示例3: CompareAsUTF16
private int CompareAsUTF16(Term term1, Term term2)
{
if (term1.Field().Equals(term2.Field()))
{
return LegacyComparator.Compare(term1.Bytes(), term2.Bytes());
}
else
{
return term1.Field().CompareTo(term2.Field());
}
}
示例4: CompareTo
/// <summary>
/// Compare the fields of the terms first, and if not equals return from
/// compare. If equal compare terms.
/// </summary>
/// <param name="term">
/// the term to compare. </param>
/// <param name="termIndex">
/// the position of the term in the input to compare </param>
/// <param name="input">
/// the input buffer. </param>
/// <returns> int. </returns>
/// <exception cref="IOException"> If there is a low-level I/O error. </exception>
private int CompareTo(Term term, int termIndex, PagedBytesDataInput input, BytesRef reuse)
{
// if term field does not equal mid's field index, then compare fields
// else if they are equal, compare term's string values...
int c = CompareField(term, termIndex, input);
if (c == 0)
{
reuse.Length = input.ReadVInt();
reuse.Grow(reuse.Length);
input.ReadBytes(reuse.Bytes, 0, reuse.Length);
return Comparator.Compare(term.Bytes(), reuse);
}
return c;
}
示例5: TermStatistics
public override TermStatistics TermStatistics(Term term, TermContext context)
{
Debug.Assert(term != null);
long docFreq = 0;
long totalTermFreq = 0;
for (int nodeID = 0; nodeID < NodeVersions.Length; nodeID++)
{
TermStatistics subStats;
if (nodeID == MyNodeID)
{
subStats = base.TermStatistics(term, context);
}
else
{
TermAndShardVersion key = new TermAndShardVersion(nodeID, NodeVersions[nodeID], term);
subStats = OuterInstance.TermStatsCache[key];
// We pre-cached during rewrite so all terms
// better be here...
Debug.Assert(subStats != null);
}
long nodeDocFreq = subStats.DocFreq();
if (docFreq >= 0 && nodeDocFreq >= 0)
{
docFreq += nodeDocFreq;
}
else
{
docFreq = -1;
}
long nodeTotalTermFreq = subStats.TotalTermFreq();
if (totalTermFreq >= 0 && nodeTotalTermFreq >= 0)
{
totalTermFreq += nodeTotalTermFreq;
}
else
{
totalTermFreq = -1;
}
}
return new TermStatistics(term.Bytes(), docFreq, totalTermFreq);
}
示例6: DumbPrefixQuery
internal DumbPrefixQuery(TestPrefixRandom outerInstance, Term term)
: base(term.Field())
{
this.OuterInstance = outerInstance;
Prefix = term.Bytes();
}