Skip to content

Commit

Permalink
Change to use property cursor for multi-property lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Mar 8, 2017
1 parent 6e1c81b commit 5cfa126
Showing 1 changed file with 15 additions and 5 deletions.
Expand Up @@ -19,6 +19,8 @@
*/
package org.neo4j.kernel.impl.api;

import org.apache.commons.lang3.ArrayUtils;

import java.util.Iterator;

import org.neo4j.collection.primitive.PrimitiveIntCollection;
Expand Down Expand Up @@ -162,14 +164,22 @@ private ExactPredicate[] getAllPropertyValues( KernelStatement state, SchemaDesc
{
int[] propertyIds = schema.getPropertyIds();
ExactPredicate[] values = new ExactPredicate[propertyIds.length];
for ( int i = 0; i < values.length; i++ )

int nMatched = 0;
Cursor<PropertyItem> nodePropertyCursor = nodeGetProperties( state, node );
while ( nodePropertyCursor.next() )
{
Object value = nodeGetProperty( state, node, propertyIds[i] );
if ( value == null )
PropertyItem property = nodePropertyCursor.get();
int k = ArrayUtils.indexOf( propertyIds, property.propertyKeyId() );
if ( k >= 0 )
{
return null;
values[k] = IndexQuery.exact( property.propertyKeyId(), property.value() );
nMatched++;
}
values[i] = IndexQuery.exact( propertyIds[i], value );
}
if ( nMatched < values.length )
{
return null;
}
return values;
}
Expand Down

0 comments on commit 5cfa126

Please sign in to comment.