//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.storageengine.api.schema.IndexSample sampleIndex() throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException public override IndexSample SampleIndex() { NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler(_indexSamplingConfig.sampleSizeLimit()); IndexReader indexReader = _indexSearcher.IndexReader; foreach (LeafReaderContext readerContext in indexReader.leaves()) { try { ISet <string> fieldNames = GetFieldNamesToSample(readerContext); foreach (string fieldName in fieldNames) { Terms terms = readerContext.reader().terms(fieldName); if (terms != null) { TermsEnum termsEnum = LuceneDocumentStructure.originalTerms(terms, fieldName); BytesRef termsRef; while ((termsRef = termsEnum.next()) != null) { sampler.Include(termsRef.utf8ToString(), termsEnum.docFreq()); CheckCancellation(); } } } } catch (IOException e) { throw new Exception(e); } } return(sampler.Result(indexReader.numDocs())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSampleASingleValue() public virtual void ShouldSampleASingleValue() { // given NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler(10); // when sampler.Include(_value, 2); // then AssertSampledValues(sampler, 2, 1, 2); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSampleNothing() public virtual void ShouldSampleNothing() { // given NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler(10); // when // nothing has been sampled // then AssertSampledValues(sampler, 0, 0, 0); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDoNothingWhenExcludingAValueInAnEmptySample() public virtual void ShouldDoNothingWhenExcludingAValueInAnEmptySample() { // given NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler(10); // when sampler.Exclude(_value, 1); sampler.Include(_value, 1); // then AssertSampledValues(sampler, 1, 1, 1); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSampleDuplicateValues() public virtual void ShouldSampleDuplicateValues() { // given NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler(10); // when sampler.Include(_value, 5); sampler.Include(_value, 4); sampler.Include("bbb", 3); // then AssertSampledValues(sampler, 12, 2, 12); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldExcludeValuesFromTheCurrentSampling1() public virtual void ShouldExcludeValuesFromTheCurrentSampling1() { // given NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler(10); sampler.Include(_value, 5); sampler.Include(_value, 4); sampler.Include("bbb", 3); // when sampler.Exclude(_value, 3); // then AssertSampledValues(sampler, 9, 2, 9); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDivideTheSamplingInStepsNotBiggerThanBatchSize() public virtual void ShouldDivideTheSamplingInStepsNotBiggerThanBatchSize() { // given NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler(1); // when sampler.Include(_value, 5); sampler.Include(_value, 4); sampler.Include("bbb", 3); // then int expectedSampledSize = 12 / 3; AssertSampledValues(sampler, 12, 1, expectedSampledSize); }