示例#1
0
 public UniqueLuceneIndexPopulatingUpdater(LuceneIndexWriter writer, int[] propertyKeyIds, SchemaIndex luceneIndex, NodePropertyAccessor nodePropertyAccessor, UniqueIndexSampler sampler) : base(writer)
 {
     this._propertyKeyIds       = propertyKeyIds;
     this._luceneIndex          = luceneIndex;
     this._nodePropertyAccessor = nodePropertyAccessor;
     this._sampler = sampler;
 }
示例#2
0
        private static void VerifySamplingResult(UniqueIndexSampler sampler, long expectedValue)
        {
            IndexSample sample = sampler.Result();

            assertEquals(expectedValue, sample.IndexSize());
            assertEquals(expectedValue, sample.UniqueValues());
            assertEquals(expectedValue, sample.SampleSize());
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void changedNodePropertiesDoNotInfluenceSample() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ChangedNodePropertiesDoNotInfluenceSample()
        {
            UniqueIndexSampler sampler = new UniqueIndexSampler();
            UniqueLuceneIndexPopulatingUpdater updater = NewUpdater(sampler);

            updater.Process(change(1, _descriptor, "before1", "after1"));
            updater.Process(change(2, _descriptor, "before2", "after2"));

            VerifySamplingResult(sampler, 0);
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void addedNodePropertiesIncludedInSample() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void AddedNodePropertiesIncludedInSample()
        {
            UniqueIndexSampler sampler = new UniqueIndexSampler();
            UniqueLuceneIndexPopulatingUpdater updater = NewUpdater(sampler);

            updater.Process(add(1, _descriptor, "foo"));
            updater.Process(add(2, _descriptor, "bar"));
            updater.Process(add(3, _descriptor, "baz"));
            updater.Process(add(4, _descriptor, "qux"));

            VerifySamplingResult(sampler, 4);
        }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void removedNodePropertyIncludedInSample() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void RemovedNodePropertyIncludedInSample()
        {
            long initialValue          = 10;
            UniqueIndexSampler sampler = new UniqueIndexSampler();

            sampler.Increment(initialValue);

            UniqueLuceneIndexPopulatingUpdater updater = NewUpdater(sampler);

            updater.Process(remove(1, _descriptor, "removed1"));
            updater.Process(remove(2, _descriptor, "removed2"));

            VerifySamplingResult(sampler, initialValue - 2);
        }
示例#6
0
        internal NativeIndexPopulator(PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout <KEY, VALUE> layout, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor, System.Action <PageCursor> additionalHeaderWriter) : base(pageCache, fs, storeFile, layout, monitor, descriptor, false)
        {
            this._treeKey   = layout.newKey();
            this._treeValue = layout.NewValue();
            this._additionalHeaderWriter = additionalHeaderWriter;
            switch (descriptor.Type())
            {
            case GENERAL:
                _uniqueSampler = null;
                break;

            case UNIQUE:
                _uniqueSampler = new UniqueIndexSampler();
                break;

            default:
                throw new System.ArgumentException("Unexpected index type " + descriptor.Type());
            }
        }
示例#7
0
 private static UniqueLuceneIndexPopulatingUpdater NewUpdater(SchemaIndex index, LuceneIndexWriter writer, UniqueIndexSampler sampler)
 {
     return(new UniqueLuceneIndexPopulatingUpdater(writer, _descriptor.PropertyIds, index, mock(typeof(NodePropertyAccessor)), sampler));
 }
示例#8
0
 private static UniqueLuceneIndexPopulatingUpdater NewUpdater(UniqueIndexSampler sampler)
 {
     return(NewUpdater(mock(typeof(SchemaIndex)), mock(typeof(LuceneIndexWriter)), sampler));
 }