deyles-zz / sculejs

SculeJS - data structures for the web
165 stars 24 forks source link

Index errors when attempting to index null values #10

Closed deyles-zz closed 11 years ago

deyles-zz commented 11 years ago

Attempting to index objects with null values in indexed fields is causing strange behaviour. For example:

collection = scule.factoryCollection('scule+dummy://test');
collection.ensureBTreeIndex('a,b', {order:1000});
for (var i=0; i < 100; i++) {
   collection.save({a:i, b:i*2});
}
collection.save({a:null, b:100});
var o = collection.find({a:null}); // returns an empty array

The issue is two fold:

  1. B+ Tree indices are not indexing null values in keys
  2. The query parser and compiler is dropping query expressions with null values from the AST (and therefore the byte code program being compiled for the virtual machine)
deyles-zz commented 11 years ago

This issue will be resolved in the v0.0.9 release