2024-05-20 00:55:24 发布
网友
在neomodel中,如何能够跨节点对象共享一个唯一的索引,而不实例化单独的对象来保存索引数据? 我想根据索引查询查找对象,例如:
... mynode = BaseObject.index.get(uid=uid_of_Type1Object) # mynode is now of type `Type1Object`
与
在https://github.com/robinedwards/neomodel/commit/1f1b43377b25cd4d41e17ce2b7f9ca1a1643edea中添加了对StructuredNode子类的自定义索引的支持
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
在https://github.com/robinedwards/neomodel/commit/1f1b43377b25cd4d41e17ce2b7f9ca1a1643edea中添加了对StructuredNode子类的自定义索引的支持
相关问题 更多 >
编程相关推荐