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


C# Term.Bytes方法代码示例

本文整理汇总了C#中Lucene.Net.Index.Term.Bytes方法的典型用法代码示例。如果您正苦于以下问题:C# Term.Bytes方法的具体用法?C# Term.Bytes怎么用?C# Term.Bytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lucene.Net.Index.Term的用法示例。


在下文中一共展示了Term.Bytes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VerifyTermDocs

 private void VerifyTermDocs(Directory dir, Term term, int numDocs)
 {
     IndexReader reader = DirectoryReader.Open(dir);
     DocsEnum docsEnum = TestUtil.Docs(Random(), reader, term.Field(), term.Bytes(), null, null, DocsEnum.FLAG_NONE);
     int count = 0;
     while (docsEnum.NextDoc() != DocIdSetIterator.NO_MORE_DOCS)
     {
         count++;
     }
     Assert.AreEqual(numDocs, count);
     reader.Dispose();
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:12,代码来源:TestAddIndexes.cs

示例2: TotalTermFreq

 /// <summary>
 /// Returns the number of documents containing the term
 /// <code>t</code>.  this method returns 0 if the term or
 /// field does not exists.  this method does not take into
 /// account deleted documents that have not yet been merged
 /// away.
 /// </summary>
 public override sealed long TotalTermFreq(Term term)
 {
     Fields fields = Fields;
     if (fields == null)
     {
         return 0;
     }
     Terms terms = fields.Terms(term.Field());
     if (terms == null)
     {
         return 0;
     }
     TermsEnum termsEnum = terms.Iterator(null);
     if (termsEnum.SeekExact(term.Bytes()))
     {
         return termsEnum.TotalTermFreq();
     }
     else
     {
         return 0;
     }
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:29,代码来源:AtomicReader.cs

示例3: TermPositionsEnum

 /// <summary>
 /// Returns <seealso cref="DocsAndPositionsEnum"/> for the specified
 ///  term.  this will return null if the
 ///  field or term does not exist or positions weren't indexed. </summary>
 ///  <seealso cref= TermsEnum#docsAndPositions(Bits, DocsAndPositionsEnum)  </seealso>
 public DocsAndPositionsEnum TermPositionsEnum(Term term)
 {
     Debug.Assert(term.Field() != null);
     Debug.Assert(term.Bytes() != null);
     Fields fields = Fields;
     if (fields != null)
     {
         Terms terms = fields.Terms(term.Field());
         if (terms != null)
         {
             TermsEnum termsEnum = terms.Iterator(null);
             if (termsEnum.SeekExact(term.Bytes()))
             {
                 return termsEnum.DocsAndPositions(LiveDocs, null);
             }
         }
     }
     return null;
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:24,代码来源:AtomicReader.cs

示例4: Build

 /// <summary>
 /// Creates a <seealso cref="TermContext"/> from a top-level <seealso cref="IndexReaderContext"/> and the
 /// given <seealso cref="Term"/>. this method will lookup the given term in all context's leaf readers
 /// and register each of the readers containing the term in the returned <seealso cref="TermContext"/>
 /// using the leaf reader's ordinal.
 /// <p>
 /// Note: the given context must be a top-level context.
 /// </summary>
 public static TermContext Build(IndexReaderContext context, Term term)
 {
     Debug.Assert(context != null && context.IsTopLevel);
     string field = term.Field();
     BytesRef bytes = term.Bytes();
     TermContext perReaderTermState = new TermContext(context);
     //if (DEBUG) System.out.println("prts.build term=" + term);
     foreach (AtomicReaderContext ctx in context.Leaves)
     {
         //if (DEBUG) System.out.println("  r=" + leaves[i].reader);
         Fields fields = ctx.AtomicReader.Fields;
         if (fields != null)
         {
             Terms terms = fields.Terms(field);
             if (terms != null)
             {
                 TermsEnum termsEnum = terms.Iterator(null);
                 if (termsEnum.SeekExact(bytes))
                 {
                     TermState termState = termsEnum.TermState();
                     //if (DEBUG) System.out.println("    found");
                     perReaderTermState.Register(termState, ctx.Ord, termsEnum.DocFreq(), termsEnum.TotalTermFreq());
                 }
             }
         }
     }
     return perReaderTermState;
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:36,代码来源:TermContext.cs


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