示例#1
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;
 }
示例#2
0
        protected override void AddTerm(string term, PostingListAddress address)
        {
            dictionaryWriter.AddTerm(term, address, existingList => occurrenceWriter.UpdateNextList(existingList, address));

            ++updates;
            if (updates > AutoCommitThreshold)
            {
                dictionaryUpdate.Commit();
                dictionaryUpdate = dictionaryWriter.BeginUpdate();
                updates          = 0;
            }
        }