Ejemplo n.º 1
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");
            }

            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;
        }
Ejemplo n.º 2
0
 protected override void DoStart()
 {
     base.DoStart();
     indexInfo        = new PersistentIndexInfo(Folder, PersistentIndex.FileNameInfo);
     fields           = PersistentMetadataFactory.CreateStorage(name.FieldsType, Folder, PersistentIndex.FileNameFields);
     occurrenceWriter = new PostingListWriter(Folder, PersistentIndex.FileNamePostingLists);
     dictionaryWriter = new PersistentDictionary(Folder, PersistentIndex.FileNameDictionary, PersistentIndex.FileNamePostingLists);
     dictionaryUpdate = dictionaryWriter.BeginUpdate();
     updates          = 0;
 }
 protected override void DoStart()
 {
     base.DoStart();
     indexInfo        = new PersistentIndexInfo(Folder, PersistentIndex.FileNameInfo);
     fields           = PersistentMetadataFactory.CreateStorage(name.FieldsType, Folder, PersistentIndex.FileNameFields);
     occurrenceWriter = PostingListIOFactory.CreateWriter(name.PostingType, Folder, PersistentIndex.FileNamePostingLists);
     dictionaryWriter = PersistentDictionaryFactory.CreateWriter(name.DictionaryType, Folder, PersistentIndex.FileNameDictionary, MaxTokenSize, name.TextEncoding);
     dictionaryUpdate = dictionaryWriter.BeginUpdate();
     posIndexWriter   = PersistentDictionaryFactory.CreateWriter(name.DictionaryType, Folder, PersistentIndex.FileNamePosIndex, PersistentIndex.PosIndexKeySize, name.TextEncoding);
     posIndexUpdate   = posIndexWriter.BeginUpdate();
     positionsWriter  = new DeltaVarIntListWriter(Folder, PersistentIndex.FileNamePositions);
     dictUpdates      = 0;
     posUpdates       = 0;
 }
Ejemplo n.º 4
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;
        }