Organize alternative names (nicknames, aliases) in neo4j

一世执手 提交于 2019-12-12 02:46:19

问题


Say you have some nodes in your model that may go by multiple alternative names, but all the names refer to the same object.

For example, you may want to be able to query the "World" node by using name "World" in one context, whereas in different context you want to find the same node quickly also by the name "Global".

Is it optimal to organize this information in the form of string array property aliases like this? :


回答1:


If you add World to your aliases you can use the legacy node_auto_index to index that aliases field

which will index each value individually and the query it with

Start n=node:node_auto_index(aliases="Global") return n




回答2:


I think you could use Lucene for that. You could index the same property several times with different names.

You can then query the index in the way you want through Java APIs or Cypher. For instance:

START n = node:myIndex(myProperty="ALIAS_1"), 
      m = node:myIndex(myProperty="ALIAS_2")
[...]


来源:https://stackoverflow.com/questions/24327139/organize-alternative-names-nicknames-aliases-in-neo4j

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!