• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Index.AtomicReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



AtomicReader类属于Lucene.Net.Index命名空间,在下文中一共展示了AtomicReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AtomicReaderContext

 /// <summary>
 /// Creates a new <seealso cref="AtomicReaderContext"/>
 /// </summary>
 internal AtomicReaderContext(CompositeReaderContext parent, AtomicReader reader, int ord, int docBase, int leafOrd, int leafDocBase)
     : base(parent, ord, docBase)
 {
     this.Ord = leafOrd;
     this.DocBase = leafDocBase;
     this.reader = reader;
     this.leaves = IsTopLevel ? new[] { this } : null; //LUCENE TO-DO suspicous
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:11,代码来源:AtomicReaderContext.cs


示例2: StandardDirectoryReader

 /// <summary>
 /// called only from static open() methods </summary>
 internal StandardDirectoryReader(Directory directory, AtomicReader[] readers, IndexWriter writer, SegmentInfos sis, int termInfosIndexDivisor, bool applyAllDeletes)
     : base(directory, readers)
 {
     this.Writer = writer;
     this.SegmentInfos = sis;
     this.TermInfosIndexDivisor = termInfosIndexDivisor;
     this.ApplyAllDeletes = applyAllDeletes;
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:10,代码来源:StandardDirectoryReader.cs


示例3: Unwrap

 /// <summary>
 /// Get the wrapped instance by <code>reader</code> as long as this reader is
 ///  an intance of <seealso cref="FilterAtomicReader"/>.
 /// </summary>
 public static AtomicReader Unwrap(AtomicReader reader)
 {
     while (reader is FilterAtomicReader)
     {
         reader = ((FilterAtomicReader)reader)[email protected];
     }
     return reader;
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:12,代码来源:FilterAtomicReader.cs


示例4: AssertingAtomicReader

 public AssertingAtomicReader(AtomicReader @in)
     : base(@in)
 {
     // check some basic reader sanity
     Debug.Assert(@in.MaxDoc >= 0);
     Debug.Assert(@in.NumDocs <= @in.MaxDoc);
     Debug.Assert(@in.NumDeletedDocs + @in.NumDocs == @in.MaxDoc);
     Debug.Assert([email protected] || @in.NumDeletedDocs > 0 && @in.NumDocs < @in.MaxDoc);
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:9,代码来源:AssertingAtomicReader.cs


示例5: AssertingAtomicReader

 public AssertingAtomicReader(AtomicReader @in)
     : base(@in)
 {
     // check some basic reader sanity
     Debug.Assert(@in.MaxDoc() >= 0);
     Debug.Assert(@in.NumDocs() <= @in.MaxDoc());
     Debug.Assert(@in.NumDeletedDocs() + @in.NumDocs() == @in.MaxDoc());
     Debug.Assert([email protected]() || @in.NumDeletedDocs() > 0 && @in.NumDocs() < @in.MaxDoc());
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:9,代码来源:AssertingAtomicReader.cs


示例6: CachedDistanceFunctionValue

            public CachedDistanceFunctionValue(AtomicReader reader, ShapeFieldCacheDistanceValueSource enclosingInstance)
            {
                cache = enclosingInstance.provider.GetCache(reader);
                this.enclosingInstance = enclosingInstance;

                from = enclosingInstance.from;
                calculator = enclosingInstance.ctx.GetDistCalc();
                nullValue = (enclosingInstance.ctx.IsGeo() ? 180 : double.MaxValue);
            }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:9,代码来源:ShapeFieldCacheDistanceValueSource.cs


示例7: Warm

        public override void Warm(AtomicReader reader)
        {
            long startTime = DateTime.Now.Millisecond;
            int indexedCount = 0;
            int docValuesCount = 0;
            int normsCount = 0;
            foreach (FieldInfo info in reader.FieldInfos)
            {
                if (info.Indexed)
                {
                    reader.Terms(info.Name);
                    indexedCount++;

                    if (info.HasNorms())
                    {
                        reader.GetNormValues(info.Name);
                        normsCount++;
                    }
                }

                if (info.HasDocValues())
                {
                    switch (info.DocValuesType)
                    {
                        case DocValuesType_e.NUMERIC:
                            reader.GetNumericDocValues(info.Name);
                            break;

                        case DocValuesType_e.BINARY:
                            reader.GetBinaryDocValues(info.Name);
                            break;

                        case DocValuesType_e.SORTED:
                            reader.GetSortedDocValues(info.Name);
                            break;

                        case DocValuesType_e.SORTED_SET:
                            reader.GetSortedSetDocValues(info.Name);
                            break;

                        default:
                            Debug.Assert(false); // unknown dv type
                            break;
                    }
                    docValuesCount++;
                }
            }

            reader.Document(0);
            reader.GetTermVectors(0);

            if (InfoStream.IsEnabled("SMSW"))
            {
                InfoStream.Message("SMSW", "Finished warming segment: " + reader + ", indexed=" + indexedCount + ", docValues=" + docValuesCount + ", norms=" + normsCount + ", time=" + (DateTime.Now.Millisecond - startTime));
            }
        }
开发者ID:joyanta,项目名称:lucene.net,代码行数:56,代码来源:SimpleMergedSegmentWarmer.cs


示例8: Build

 /// <summary>
 /// Creates a <seealso cref="DocMap"/> instance appropriate for
 ///  this reader.
 /// </summary>
 public static DocMap Build(AtomicReader reader)
 {
     int maxDoc = reader.MaxDoc();
     if (!reader.HasDeletions())
     {
         return new NoDelDocMap(maxDoc);
     }
     Bits liveDocs = reader.LiveDocs;
     return Build(maxDoc, liveDocs);
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:14,代码来源:MergeState.cs


示例9: GetDocsAndPositions

 public virtual DocsAndPositionsEnum GetDocsAndPositions(AtomicReader reader, BytesRef bytes, Bits liveDocs)
 {
     Terms terms = reader.Terms(FieldName);
     if (terms != null)
     {
         TermsEnum te = terms.Iterator(null);
         if (te.SeekExact(bytes))
         {
             return te.DocsAndPositions(liveDocs, null);
         }
     }
     return null;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:13,代码来源:TestDocsAndPositions.cs


示例10: DistanceFunctionValue

            public DistanceFunctionValue(DistanceValueSource outerInstance, AtomicReader reader)
            {
                this.outerInstance = outerInstance;

                ptX = FieldCache.DEFAULT.GetDoubles(reader, outerInstance.strategy.FieldNameX, true);
                ptY = FieldCache.DEFAULT.GetDoubles(reader, outerInstance.strategy.FieldNameY, true);
                validX = FieldCache.DEFAULT.GetDocsWithField(reader, outerInstance.strategy.FieldNameX);
                validY = FieldCache.DEFAULT.GetDocsWithField(reader, outerInstance.strategy.FieldNameY);

                from = outerInstance.from;
                calculator = outerInstance.strategy.SpatialContext.DistCalc;
                nullValue = (outerInstance.strategy.SpatialContext.IsGeo ? 180 * outerInstance.multiplier : double.MaxValue);
            }
开发者ID:apache,项目名称:lucenenet,代码行数:13,代码来源:DistanceValueSource.cs


示例11: DistanceFunctionValue

            public DistanceFunctionValue(DistanceValueSource enclosingInstance, AtomicReader reader)
            {
                this.enclosingInstance = enclosingInstance;

                ptX = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.FieldNameX, true);
                ptY = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.FieldNameY, true);
                validX = FieldCache.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.FieldNameX);
                validY = FieldCache.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.FieldNameY);

                from = enclosingInstance.from;
                calculator = enclosingInstance.strategy.SpatialContext.GetDistCalc();
                nullValue = (enclosingInstance.strategy.SpatialContext.IsGeo() ? 180 : double.MaxValue);
            }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:13,代码来源:DistanceValueSource.cs


示例12: BBoxSimilarityValueSourceFunctionValue

            public BBoxSimilarityValueSourceFunctionValue(AtomicReader reader,
                                                          BBoxSimilarityValueSource enclosingInstance)
            {
                _enclosingInstance = enclosingInstance;
                rect = _enclosingInstance.strategy.SpatialContext.MakeRectangle(0, 0, 0, 0); //reused

                minX = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_minX, true);
                minY = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_minY, true);
                maxX = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_maxX, true);
                maxY = FieldCache.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_maxY, true);

                validMinX = FieldCache.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.field_minX);
                validMaxX = FieldCache.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.field_maxX);
            }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:14,代码来源:BBoxSimilarityValueSource.cs


示例13: CorrectBits

        private FixedBitSet CorrectBits(AtomicReader reader, Bits acceptDocs)
        {
            FixedBitSet bits = new FixedBitSet(reader.MaxDoc); //assume all are INvalid
            Terms terms = reader.Fields.Terms(fieldName);

            if (terms == null)
            {
                return bits;
            }

            TermsEnum termsEnum = terms.Iterator(null);
            DocsEnum docs = null;
            while (true)
            {
                BytesRef currTerm = termsEnum.Next();
                if (currTerm == null)
                {
                    break;
                }
                else
                {
                    docs = termsEnum.Docs(acceptDocs, docs, DocsEnum.FLAG_NONE);
                    int doc = docs.NextDoc();
                    if (doc != DocIdSetIterator.NO_MORE_DOCS)
                    {
                        if (keepMode == KeepMode.KM_USE_FIRST_OCCURRENCE)
                        {
                            bits.Set(doc);
                        }
                        else
                        {
                            int lastDoc = doc;
                            while (true)
                            {
                                lastDoc = doc;
                                doc = docs.NextDoc();
                                if (doc == DocIdSetIterator.NO_MORE_DOCS)
                                {
                                    break;
                                }
                            }
                            bits.Set(lastDoc);
                        }
                    }
                }
            }
            return bits;
        }
开发者ID:apache,项目名称:lucenenet,代码行数:48,代码来源:DuplicateFilter.cs


示例14: CheckNorms

 public static void CheckNorms(AtomicReader reader)
 {
     // test omit norms
     for (int i = 0; i < DocHelper.Fields.Length; i++)
     {
         IndexableField f = DocHelper.Fields[i];
         if (f.FieldType().Indexed)
         {
             Assert.AreEqual(reader.GetNormValues(f.Name()) != null, !f.FieldType().OmitNorms);
             Assert.AreEqual(reader.GetNormValues(f.Name()) != null, !DocHelper.NoNorms.ContainsKey(f.Name()));
             if (reader.GetNormValues(f.Name()) == null)
             {
                 // test for norms of null
                 NumericDocValues norms = MultiDocValues.GetNormValues(reader, f.Name());
                 Assert.IsNull(norms);
             }
         }
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:19,代码来源:TestSegmentReader.cs


示例15: DocIdSetToCache

        protected override DocIdSet DocIdSetToCache(DocIdSet docIdSet, AtomicReader reader)
        {
            if (docIdSet == null)
            {
                return EMPTY_DOCIDSET;
            }

            if (docIdSet is FixedBitSet)
            {
                // this is different from CachingWrapperFilter: even when the DocIdSet is
                // cacheable, we convert it to a FixedBitSet since we require all the
                // cached filters to be FixedBitSets
                return docIdSet;
            }

            DocIdSetIterator it = docIdSet.GetIterator();
            if (it == null)
            {
                return EMPTY_DOCIDSET;
            }
            FixedBitSet copy = new FixedBitSet(reader.MaxDoc);
            copy.Or(it);
            return copy;
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:24,代码来源:FixedBitSetCachingWrapperFilter.cs


示例16: AssertSplit

        public static void AssertSplit(AtomicReader originalIndex, double testRatio, double crossValidationRatio, params string[] fieldNames)
        {
            BaseDirectoryWrapper trainingIndex = NewDirectory();
            BaseDirectoryWrapper testIndex = NewDirectory();
            BaseDirectoryWrapper crossValidationIndex = NewDirectory();

            try
            {
                DatasetSplitter datasetSplitter = new DatasetSplitter(testRatio, crossValidationRatio);
                datasetSplitter.Split(originalIndex, trainingIndex, testIndex, crossValidationIndex, new MockAnalyzer(Random()), fieldNames);

                NotNull(trainingIndex);
                NotNull(testIndex);
                NotNull(crossValidationIndex);

                DirectoryReader trainingReader = DirectoryReader.Open(trainingIndex);
                True((int)(originalIndex.MaxDoc * (1d - testRatio - crossValidationRatio)) == trainingReader.MaxDoc);
                DirectoryReader testReader = DirectoryReader.Open(testIndex);
                True((int)(originalIndex.MaxDoc * testRatio) == testReader.MaxDoc);
                DirectoryReader cvReader = DirectoryReader.Open(crossValidationIndex);
                True((int)(originalIndex.MaxDoc * crossValidationRatio) == cvReader.MaxDoc);

                trainingReader.Dispose();
                testReader.Dispose();
                cvReader.Dispose();
                CloseQuietly(trainingReader);
                CloseQuietly(testReader);
                CloseQuietly(cvReader);
            }
            finally
            {
                trainingIndex.Dispose();
                testIndex.Dispose();
                crossValidationIndex.Dispose();
            }
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:36,代码来源:DataSplitterTest.cs


示例17: Wrap

 /// <summary>
 /// Wrap one of the parent DirectoryReader's subreaders </summary>
 /// <param name="reader"> the subreader to wrap </param>
 /// <returns> a wrapped/filtered AtomicReader </returns>
 public abstract AtomicReader Wrap(AtomicReader reader);
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:5,代码来源:FilterDirectoryReader.cs


示例18: FilterAtomicReaderAnonymousInnerClassHelper

 public FilterAtomicReaderAnonymousInnerClassHelper(TestIndexReaderClose outerInstance, AtomicReader wrap, bool throwOnClose)
     : base(wrap)
 {
     this.OuterInstance = outerInstance;
     this.ThrowOnClose = throwOnClose;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:6,代码来源:TestIndexReaderClose.cs


示例19: FilterAtomicReader

 /// <summary>
 /// <p>Construct a FilterAtomicReader based on the specified base reader.
 /// <p>Note that base reader is closed if this FilterAtomicReader is closed.</p> </summary>
 /// <param name="in"> specified base reader. </param>
 public FilterAtomicReader(AtomicReader @in)
     : base()
 {
     [email protected] = @in;
     @in.RegisterParentReader(this);
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:10,代码来源:FilterAtomicReader.cs


示例20: TestTermVectors

 /// <summary>
 /// Test term vectors.
 /// @lucene.experimental
 /// </summary>
 public static Status.TermVectorStatus TestTermVectors(AtomicReader reader, TextWriter infoStream)
 {
     return TestTermVectors(reader, infoStream, false, false);
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:8,代码来源:CheckIndex.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Index.AtomicReaderContext类代码示例发布时间:2022-05-26
下一篇:
C# Documents.FieldType类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap