public PersistentIndex(PersistentIndexName name)
        {
            var folder = name.Folder;

            if (!PersistentIndexInfo.Exists(folder, FileNameInfo))
            {
                throw new InvalidOperationException("No index");
            }

            HeaderReader = new PersistentIndexInfo(folder, FileNameInfo);
            Header       = HeaderReader.Read();
            if (Header == null)
            {
                throw new InvalidOperationException("No index");
            }

            VerifyHeader(name);
            var indexType = Header.Type.Split(' ');

            Dictionary      = PersistentDictionaryFactory.Create(indexType[1], folder, FileNameDictionary, Header.MaxTokenSize, indexType[4]);
            PostingLists    = PostingListIOFactory.CreateReader(indexType[3], folder, FileNamePostingLists);
            PosIndex        = PersistentDictionaryFactory.Create(indexType[1], folder, FileNamePosIndex, PosIndexKeySize, indexType[4]);
            PositionsReader = new DeltaVarIntListReader(folder, FileNamePositions);
            Fields          = PersistentMetadataFactory.CreateStorage(indexType[2], folder, FileNameFields);
            this.name       = name;
        }
Beispiel #2
0
        public PersistentIndex(PersistentIndexName name)
        {
            var folder = name.Folder;

            if (!PersistentIndexInfo.Exists(folder, FileNameInfo))
            {
                throw new InvalidOperationException("No index");
            }

            HeaderReader = new PersistentIndexInfo(folder, FileNameInfo);
            Header       = HeaderReader.Read();
            if (Header == null)
            {
                throw new InvalidOperationException("No index");
            }

            Dictionary   = new PersistentDictionary(folder, FileNameDictionary, FileNamePostingLists);
            PostingLists = new PostingListReader(folder, FileNamePostingLists);
            Fields       = PersistentMetadataFactory.CreateStorage(Header.Type.Split(' ')[1], folder, FileNameFields);
            this.name    = name;
        }