Say that there is a relationship between 2 nodes as below
start --> "follows" --> end
I want to create an index named "Relations" and add the above relation to the index. How do I do that in Scala or in Java?
I tried doing it this way :
override def NodeIndexConfig = ("Relations", Some(Map("provider" -> "lucene", "type" -> "fulltext")))::NIL
val rel_name = group+"_Voteup"
val relation = user_node --> rel_name --> item_node
val Relation_Index = getNodeIndex("Relations").get
val rel_value = user_id+item_id+rel_name
Relation_Index += (relation,"rel_id",rel_value)
But, am getting Type mismatch error.
You should probably use the relation index instead of the node index, like
override def RelationIndexConfig = ("Relations", Some(Map("provider" -> "lucene", "type" -> "fulltext")))::Nil
val rel_name = group+"_Voteup"
val relation = user_node --> rel_name --> item_node
val Relation_Index = getRelationIndex("Relations")
val rel_value = user_id+item_id+rel_name
Relation_Index.foreach(_ += (relation,"rel_id",rel_value))
NOTE: I removed the index.get
call and used a "safer" foreach
call on the optional value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.