how is it possible in neomodel to share a unique index across node objects, without instantiating separate objects to just hold the indexed data? I'd like to find the object based on a index query, e.g like this:
...
mynode = BaseObject.index.get(uid=uid_of_Type1Object)
# mynode is now of type `Type1Object`
with
class BaseObject(StructuredNode):
uid = StringProperty(unique_index=True)
...
class Type1Object(BaseObject):
...
def assign_uid(self, guid):
# I may need tweaking of uid generator
# on subclass level
self.uid = guid
class Type2Object(BaseObject):
...
def assign_uid(self, guid):
self.uid = guid
In https://github.com/robinedwards/neomodel/commit/1f1b43377b25cd4d41e17ce2b7f9ca1a1643edea it was added support for custom index on StructuredNode subclasess
class BaseObject(StructuredNode):
__index__ = 'MyBaseIndex'
uid = StringProperty(unique_index=True)
...
class Type1Object(BaseObject):
__index__ = 'MyBaseIndex'
...
def assign_uid(self, guid):
# I may need tweaking of uid generator
# on subclass level
self.uid = guid
class Type2Object(BaseObject):
__index__ = 'MyBaseIndex'
...
def assign_uid(self, guid):
self.uid = guid