Note that nulls are not included into indexes. In other words, if a
nullable
field is indexed, and an object of the class has the null indicator set to true for that field, that object will not be included in the index. Therefore, take care that there is some other access method other than through an index on anullable
field(s). For example, consider a schema like the following:C/C++/Python: class Record { nullable uint4 id; string name; tree<id> by_id; }; Java: class Record { @Indexable(unique=true) @nullable int id; public String name; } C#: class Record { [Indexable(Unique=true)] public int? id; public String name; }Any objects of class
Record
with thenull
indicator set forid
will be inaccessible. As soon as thenull
indicator is set and the transaction committed, the object will be removed from the index. With no other access method to locate the object, it becomes inaccessible.Also, note that although an index on a nullable field can be used for lookups, this index can not be used for sorting objects by this field. And nullable fields cannot be included in compound indexes.