Bool and NSDate properties can be indexed.
Core supports indexing Bool and NSDate properties. realm-java also supports indexing Bool and NSDate properties. It is better to align the specification with realm-java.
This commit is contained in:
parent
062db0e95d
commit
9045d79453
|
@ -55,6 +55,7 @@ namespace realm {
|
||||||
|
|
||||||
size_t table_column = -1;
|
size_t table_column = -1;
|
||||||
bool requires_index() const { return is_primary || is_indexed; }
|
bool requires_index() const { return is_primary || is_indexed; }
|
||||||
|
bool is_indexable() const { return type == PropertyTypeInt || type == PropertyTypeBool || type == PropertyTypeString || type == PropertyTypeDate; }
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline const char *string_for_property_type(PropertyType type) {
|
static inline const char *string_for_property_type(PropertyType type) {
|
||||||
|
|
|
@ -89,7 +89,7 @@ void Schema::validate() const
|
||||||
|
|
||||||
// check indexable
|
// check indexable
|
||||||
if (prop.is_indexed) {
|
if (prop.is_indexed) {
|
||||||
if (prop.type != PropertyTypeString && prop.type != PropertyTypeInt) {
|
if (!prop.is_indexable()) {
|
||||||
exceptions.emplace_back(PropertyTypeNotIndexableException(object.name, prop));
|
exceptions.emplace_back(PropertyTypeNotIndexableException(object.name, prop));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue