private void VerifyHeader(PersistentIndexName name) { var types = Header.Type.Split(' '); if (types[0] != nameof(PersistentIndex)) { throw new InvalidOperationException("Index type and name mismatch"); } if (name.DictionaryType != PersistentIndexName.DefaultValue && types[1] != name.DictionaryType) { throw new InvalidOperationException("Index type and name mismatch"); } if (name.FieldsType != PersistentIndexName.DefaultValue && types[2] != name.FieldsType) { throw new InvalidOperationException("Index type and name mismatch"); } if (name.PostingType != PersistentIndexName.DefaultValue && types[3] != name.PostingType) { throw new InvalidOperationException("Index type and name mismatch"); } if (name.TextEncoding != PersistentIndexName.DefaultValue && types[4] != name.TextEncoding) { throw new InvalidOperationException("Index type and name mismatch"); } }
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; }
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; }
public PersistentBuilder(PersistentIndexName name) { this.name = name; }