Commit 4bbf2b54 authored by lutovich's avatar lutovich
Browse files

Fixed reading of non-unique index fields during sampling

parent 53c05895
No related merge requests found
Showing with 9 additions and 5 deletions
+9 -5
......@@ -27,18 +27,16 @@ import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.util.BytesRef;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import org.neo4j.helpers.TaskControl;
import org.neo4j.helpers.collection.Iterables;
import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException;
import org.neo4j.kernel.api.impl.schema.LuceneDocumentStructure;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.api.index.sampling.NonUniqueIndexSampler;
import org.neo4j.register.Register;
import static org.neo4j.kernel.api.impl.schema.LuceneDocumentStructure.NODE_ID_KEY;
/**
* Sampler for non-unique Lucene schema index.
* Internally uses terms and their document frequencies for sampling.
......@@ -92,8 +90,14 @@ public class NonUniqueLuceneIndexSampler extends LuceneIndexSampler
private static Set<String> getFieldNamesToSample( LeafReaderContext readerContext ) throws IOException
{
Fields fields = readerContext.reader().fields();
Set<String> fieldNames = Iterables.toSet( fields );
assert fieldNames.remove( NODE_ID_KEY );
Set<String> fieldNames = new HashSet<>();
for ( String field : fields )
{
if ( !LuceneDocumentStructure.NODE_ID_KEY.equals( field ) )
{
fieldNames.add( field );
}
}
return fieldNames;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment