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


C# SegmentInfos.GetVersion方法代码示例

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


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

示例1: ReadCurrentVersion

        /// <summary> Current version number from segments file.</summary>
        public static long ReadCurrentVersion(Directory directory)
        {
            IndexInput input = directory.OpenInput(IndexFileNames.SEGMENTS);
            int format = 0;
            long version = 0;
            try
            {
                format = input.ReadInt();
                if (format < 0)
                {
                    if (format < FORMAT)
                        throw new System.IO.IOException("Unknown format version: " + format);
                    version = input.ReadLong(); // read version
                }
            }
            finally
            {
                input.Close();
            }

            if (format < 0)
                return version;

            // We cannot be sure about the format of the file.
            // Therefore we have to read the whole file and cannot simply seek to the version entry.

            SegmentInfos sis = new SegmentInfos();
            sis.Read(directory);
            return sis.GetVersion();
        }
开发者ID:karino2,项目名称:wikipediaconv,代码行数:31,代码来源:SegmentInfos.cs

示例2: DoBody

            protected internal override object DoBody(System.String segmentFileName)
            {
                IndexInput input = directory.OpenInput(segmentFileName);

                int format = 0;
                long version = 0;
                try
                {
                    format = input.ReadInt();
                    if (format < 0)
                    {
                        if (format < Lucene.Net.Index.SegmentInfos.CURRENT_FORMAT)
                            throw new CorruptIndexException("Unknown format version: " + format);
                        version = input.ReadLong(); // read version
                    }
                }
                finally
                {
                    input.Close();
                }

                if (format < 0)
                    return (long) version;

                // We cannot be sure about the format of the file.
                // Therefore we have to read the whole file and cannot simply seek to the version entry.
                SegmentInfos sis = new SegmentInfos();
                sis.Read(directory, segmentFileName);
                return (long) sis.GetVersion();
            }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:30,代码来源:SegmentInfos.cs

示例3: CommitPoint

            public CommitPoint(IndexFileDeleter enclosingInstance, System.Collections.ICollection commitsToDelete, Directory directory, SegmentInfos segmentInfos)
            {
                InitBlock(enclosingInstance);
                this.directory = directory;
                this.commitsToDelete = commitsToDelete;
                userData = segmentInfos.GetUserData();
                segmentsFileName = segmentInfos.GetCurrentSegmentFileName();
                version = segmentInfos.GetVersion();
                generation = segmentInfos.GetGeneration();
                files = segmentInfos.Files(directory, true);
                gen = segmentInfos.GetGeneration();
                isOptimized = segmentInfos.Count == 1 && !segmentInfos.Info(0).HasDeletions();

                System.Diagnostics.Debug.Assert(!segmentInfos.HasExternalSegments(directory));
            }
开发者ID:sinsay,项目名称:SSE,代码行数:15,代码来源:IndexFileDeleter.cs

示例4: ReaderCommit

 internal ReaderCommit(SegmentInfos infos, Directory dir)
 {
     segmentsFileName = infos.GetCurrentSegmentFileName();
     this.dir = dir;
     int size = infos.Count;
     files = new List<string>(size);
     files.Add(segmentsFileName);
     for (int i = 0; i < size; i++)
     {
         SegmentInfo info = infos.Info(i);
         if (info.dir == dir)
             SupportClass.CollectionsSupport.AddAll(info.Files(), files);
     }
     version = infos.GetVersion();
     generation = infos.GetGeneration();
     isOptimized = infos.Count == 1 && !infos.Info(0).HasDeletions();
 }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:17,代码来源:DirectoryIndexReader.cs

示例5: ReaderCommit

			internal ReaderCommit(SegmentInfos infos, Directory dir)
			{
				segmentsFileName = infos.GetCurrentSegmentFileName();
				this.dir = dir;
				userData = infos.GetUserData();
                files = infos.Files(dir, true);
				version = infos.GetVersion();
				generation = infos.GetGeneration();
				isOptimized = infos.Count == 1 && !infos.Info(0).HasDeletions();
			}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:10,代码来源:DirectoryReader.cs

示例6: CommitPoint

 public CommitPoint(IndexFileDeleter enclosingInstance, ICollection<IndexCommitPoint> commitsToDelete, Directory directory, SegmentInfos segmentInfos)
 {
     InitBlock(enclosingInstance);
     this.directory = directory;
     this.commitsToDelete = commitsToDelete;
     segmentsFileName = segmentInfos.GetCurrentSegmentFileName();
     version = segmentInfos.GetVersion();
     generation = segmentInfos.GetGeneration();
     int size = segmentInfos.Count;
     files = new List<string>(size);
     files.Add(segmentsFileName);
     gen = segmentInfos.GetGeneration();
     for (int i = 0; i < size; i++)
     {
         SegmentInfo segmentInfo = segmentInfos.Info(i);
         if (segmentInfo.dir == Enclosing_Instance.directory)
         {
             SupportClass.CollectionsSupport.AddAll(segmentInfo.Files(), files);
         }
     }
     isOptimized = segmentInfos.Count == 1 && !segmentInfos.Info(0).HasDeletions();
 }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:22,代码来源:IndexFileDeleter.cs


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