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


C# IndexReader.GetSequentialSubReaders方法代码示例

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


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

示例1: CreateFilters

        public static IDictionary<string, Filter> CreateFilters(IndexReader reader, IDictionary<string, HashSet<string>> feeds)
        {
            var bitSetLookup = new Dictionary<string, IDictionary<string, OpenBitSet>>(StringComparer.OrdinalIgnoreCase);

            foreach (var key in feeds.Keys)
            {
                bitSetLookup[key] = new Dictionary<string, OpenBitSet>();

                foreach (SegmentReader segmentReader in reader.GetSequentialSubReaders())
                {
                    bitSetLookup[key][segmentReader.SegmentName] = new OpenBitSet();
                }
            }

            foreach (SegmentReader segmentReader in reader.GetSequentialSubReaders())
            {
                CreateOpenBitSets(segmentReader, feeds, bitSetLookup);
            }

            var filters = new Dictionary<string, Filter>(StringComparer.OrdinalIgnoreCase);

            foreach (var key in feeds.Keys)
            {
                filters[key] = new OpenBitSetLookupFilter(bitSetLookup[key]);
            }

            return filters;
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:28,代码来源:CuratedFeedFilter.cs

示例2: Process

        public void Process(IndexReader indexReader)
        {
            var perIndexDocumentNumber = 0;

            foreach (var handler in _handlers)
            {
                handler.Begin(indexReader);
            }

            if (_enumerateSubReaders && indexReader.GetSequentialSubReaders() != null)
            {
                foreach (SegmentReader segmentReader in indexReader.GetSequentialSubReaders())
                {
                    ProcessReader(segmentReader, segmentReader.SegmentName, ref perIndexDocumentNumber);
                }
            }
            else
            {
                ProcessReader(indexReader, string.Empty, ref perIndexDocumentNumber);
            }

            foreach (var handler in _handlers)
            {
                handler.End(indexReader);
            }
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:26,代码来源:IndexReaderProcessor.cs

示例3: Create

        public static Filter Create(IndexReader indexReader, bool includePrerelease, bool includeUnlisted)
        {
            IDictionary<string, OpenBitSet> openBitSetLookup = new Dictionary<string, OpenBitSet>();

            if (indexReader.GetSequentialSubReaders() != null)
            {
                foreach (SegmentReader segmentReader in indexReader.GetSequentialSubReaders())
                {
                    openBitSetLookup.Add(segmentReader.SegmentName, new OpenBitSet());
                }
            }
            else
            {
                openBitSetLookup.Add(string.Empty, new OpenBitSet());
            }

            IDictionary<string, Tuple<NuGetVersion, string, int>> lookup = MakeLatestVersionLookup(indexReader, includePrerelease, includeUnlisted);

            foreach (Tuple<NuGetVersion, string, int> entry in lookup.Values)
            {
                string readerName = entry.Item2;
                int readerDocumentId = entry.Item3;

                openBitSetLookup[readerName].Set(readerDocumentId);
            }

            return new OpenBitSetLookupFilter(openBitSetLookup);
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:28,代码来源:LatestVersionFilterFactory.cs

示例4: Begin

        public void Begin(IndexReader indexReader)
        {
            _bitSetLookup = new Dictionary<string, IDictionary<string, OpenBitSet>>(StringComparer.OrdinalIgnoreCase);

            if (indexReader.GetSequentialSubReaders() != null)
            {
                foreach (var key in _feeds.Keys)
                {
                    _bitSetLookup[key] = new Dictionary<string, OpenBitSet>();

                    foreach (SegmentReader segmentReader in indexReader.GetSequentialSubReaders())
                    {
                        _bitSetLookup[key][segmentReader.SegmentName] = new OpenBitSet();
                    }
                }
            }
            else
            {
                foreach (var key in _feeds.Keys)
                {
                    _bitSetLookup[key] = new Dictionary<string, OpenBitSet>();
                    _bitSetLookup[key][string.Empty] = new OpenBitSet();
                }
            }
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:25,代码来源:CuratedFeedHandler.cs

示例5: Begin

 public void Begin(IndexReader indexReader)
 {
     if (indexReader.GetSequentialSubReaders() != null)
     {
         foreach (SegmentReader segmentReader in indexReader.GetSequentialSubReaders())
         {
             _mapping[segmentReader.SegmentName] = new int[segmentReader.MaxDoc];
         }
     }
     else
     {
         _mapping[string.Empty] = new int[indexReader.MaxDoc];
     }
 }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:14,代码来源:SegmentToMainReaderMappingHandler.cs

示例6: Begin

        public void Begin(IndexReader indexReader)
        {
            _rankingBySegmentReaderName = new RankingBySegment();

            if (indexReader.GetSequentialSubReaders() != null)
            {
                foreach (SegmentReader segmentReader in indexReader.GetSequentialSubReaders())
                {
                    _rankingBySegmentReaderName[segmentReader.SegmentName] = new Ranking[segmentReader.MaxDoc];
                }
            }
            else
            {
                _rankingBySegmentReaderName[string.Empty] = new Ranking[indexReader.MaxDoc];
            }
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:16,代码来源:RankingsHandler.cs

示例7: Begin

        public void Begin(IndexReader indexReader)
        {
            _openBitSetLookup = new Dictionary<string, OpenBitSet>();
            _lookup = new Dictionary<string, Tuple<NuGetVersion, string, int>>();

            if (indexReader.GetSequentialSubReaders() != null)
            {
                foreach (SegmentReader segmentReader in indexReader.GetSequentialSubReaders())
                {
                    _openBitSetLookup.Add(segmentReader.SegmentName, new OpenBitSet());
                }
            }
            else
            {
                _openBitSetLookup.Add(string.Empty, new OpenBitSet());
            }
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:17,代码来源:LatestListedHandler.cs

示例8: Begin

        public void Begin(IndexReader indexReader)
        {
            _knownOwners = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
            _ownerTuples = new Dictionary<string, IDictionary<string, DynamicDocIdSet>>();

            if (indexReader.GetSequentialSubReaders() != null)
            {
                foreach (SegmentReader segmentReader in indexReader.GetSequentialSubReaders())
                {
                    _ownerTuples.Add(segmentReader.SegmentName, new Dictionary<string, DynamicDocIdSet>(StringComparer.OrdinalIgnoreCase));
                }
            }
            else
            {
                _ownerTuples.Add(string.Empty, new Dictionary<string, DynamicDocIdSet>(StringComparer.OrdinalIgnoreCase));
            }
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:17,代码来源:OwnersHandler.cs

示例9: MakeLatestVersionLookup

        static IDictionary<string, Tuple<NuGetVersion, string, int>> MakeLatestVersionLookup(IndexReader indexReader, bool includePrerelease, bool includeUnlisted)
        {
            IDictionary<string, Tuple<NuGetVersion, string, int>> lookup = new Dictionary<string, Tuple<NuGetVersion, string, int>>();

            if (indexReader.GetSequentialSubReaders() != null)
            {
                foreach (SegmentReader segmentReader in indexReader.GetSequentialSubReaders())
                {
                    MakeLatestVersionLookupPerReader(lookup, segmentReader, segmentReader.SegmentName, includePrerelease, includeUnlisted);
                }
            }
            else
            {
                MakeLatestVersionLookupPerReader(lookup, indexReader, string.Empty, includePrerelease, includeUnlisted);
            }

            return lookup;
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:18,代码来源:LatestVersionFilterFactory.cs

示例10: MakeLatestVersionLookup

        static IDictionary<string, Tuple<NuGetVersion, string, int>> MakeLatestVersionLookup(IndexReader indexReader, bool includePrerelease, bool includeUnlisted)
        {
            IDictionary<string, Tuple<NuGetVersion, string, int>> lookup = new Dictionary<string, Tuple<NuGetVersion, string, int>>();

            foreach (SegmentReader segmentReader in indexReader.GetSequentialSubReaders())
            {
                for (int n = 0; n < segmentReader.MaxDoc; n++)
                {
                    if (segmentReader.IsDeleted(n))
                    {
                        continue;
                    }

                    Document document = segmentReader.Document(n);

                    NuGetVersion version = GetVersion(document);

                    if (version == null)
                    {
                        continue;
                    }

                    bool isListed = GetListed(document);

                    if (isListed || includeUnlisted)
                    {
                        if (!version.IsPrerelease || includePrerelease)
                        {
                            string id = GetId(document);

                            if (id == null)
                            {
                                continue;
                            }

                            Tuple<NuGetVersion, string, int> existingVersion;
                            if (lookup.TryGetValue(id, out existingVersion))
                            {
                                if (version > existingVersion.Item1)
                                {
                                    lookup[id] = Tuple.Create(version, segmentReader.SegmentName, n);
                                }
                            }
                            else
                            {
                                lookup.Add(id, Tuple.Create(version, segmentReader.SegmentName, n));
                            }
                        }
                    }
                }
            }

            return lookup;
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:54,代码来源:LatestVersionFilter.cs

示例11: CreateBitSetsLookup

        public static IDictionary<string, BitSetsLookupEntry> CreateBitSetsLookup(IndexReader reader, IDictionary<string, ISet<string>> frameworkCompatibility)
        {
            //  This is a two step process because we first need to calculate the highest version across the whole data set (i.e. across every segment)

            //  STEP 1. Create a lookup table of compatible documents (identified by SegmentName and Doc) per entry in the framework compatibility table
            //  (The result include separate structures for release-only and including pre-release.)

            IDictionary<string, MatchingDocsEntry> matchingDocsLookup = new Dictionary<string, MatchingDocsEntry>();

            foreach (string key in frameworkCompatibility.Keys)
            {
                matchingDocsLookup[key] = new MatchingDocsEntry();
            }

            foreach (SegmentReader segmentReader in reader.GetSequentialSubReaders())
            {
                UpdateMatchingDocs(matchingDocsLookup, segmentReader, frameworkCompatibility);
            }

            //  STEP 2. From the globally created MatchingDocsLookup table we create per-segment lookups 

            IDictionary<string, BitSetsLookupEntry> bitSetsLookup = new Dictionary<string, BitSetsLookupEntry>();

            foreach (string key in frameworkCompatibility.Keys)
            {
                BitSetsLookupEntry newBitSetsLookupEntry = new BitSetsLookupEntry();

                foreach (SegmentReader segmentReader in reader.GetSequentialSubReaders())
                {
                    newBitSetsLookupEntry.MatchingDocs.Add(segmentReader.SegmentName, new OpenBitSet());
                    newBitSetsLookupEntry.MatchingDocsPre.Add(segmentReader.SegmentName, new OpenBitSet());
                }

                bitSetsLookup[key] = newBitSetsLookupEntry;
            }

            foreach (KeyValuePair<string, MatchingDocsEntry> entry in matchingDocsLookup)
            {
                foreach (MatchingDoc matchingDoc in entry.Value.MatchingDocs.Values)
                {
                    bitSetsLookup[entry.Key].MatchingDocs[matchingDoc.SegmentName].Set(matchingDoc.Doc);
                }
                foreach (MatchingDoc matchingDocPre in entry.Value.MatchingDocsPre.Values)
                {
                    bitSetsLookup[entry.Key].MatchingDocsPre[matchingDocPre.SegmentName].Set(matchingDocPre.Doc);
                }
            }

            return bitSetsLookup;
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:50,代码来源:Compatibility.cs

示例12: GetOnlySegmentReader

		public /*internal*/ static SegmentReader GetOnlySegmentReader(IndexReader reader)
		{
			if (reader is SegmentReader)
				return (SegmentReader) reader;
			
			if (reader is DirectoryReader)
			{
				IndexReader[] subReaders = reader.GetSequentialSubReaders();
				if (subReaders.Length != 1)
				{
					throw new System.ArgumentException(reader + " has " + subReaders.Length + " segments instead of exactly one");
				}
				
				return (SegmentReader) subReaders[0];
			}
			
			throw new System.ArgumentException(reader + " is not a SegmentReader or a single-segment DirectoryReader");
		}
开发者ID:nzdunic,项目名称:ravendb,代码行数:18,代码来源:SegmentReader.cs

示例13: AssertReaderClosed

		private void  AssertReaderClosed(IndexReader reader, bool checkSubReaders, bool checkNormsClosed)
		{
			Assert.AreEqual(0, reader.GetRefCount());
			
			if (checkNormsClosed && reader is SegmentReader)
			{
				Assert.IsTrue(((SegmentReader) reader).NormsClosed());
			}
			
			if (checkSubReaders)
			{
				if (reader is DirectoryReader)
				{
					IndexReader[] subReaders = reader.GetSequentialSubReaders();
					for (int i = 0; i < subReaders.Length; i++)
					{
						AssertReaderClosed(subReaders[i], checkSubReaders, checkNormsClosed);
					}
				}
				
				if (reader is MultiReader)
				{
					IndexReader[] subReaders = reader.GetSequentialSubReaders();
					for (int i = 0; i < subReaders.Length; i++)
					{
						AssertReaderClosed(subReaders[i], checkSubReaders, checkNormsClosed);
					}
				}
				
				if (reader is ParallelReader)
				{
					IndexReader[] subReaders = ((ParallelReader) reader).GetSubReaders();
					for (int i = 0; i < subReaders.Length; i++)
					{
						AssertReaderClosed(subReaders[i], checkSubReaders, checkNormsClosed);
					}
				}
			}
		}
开发者ID:Mpdreamz,项目名称:lucene.net,代码行数:39,代码来源:TestIndexReaderReopen.cs


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