How to model database to support RAG vector search on relationships if possible

Hi neo4jedis

I have a modeling question that may have been asked before but I couldn't find my exact use case in the forums.

I have social network project that helps connect Person nodes to other Person nodes using KNOWS and ENDORSES relationships.

Previously I modeled this with 3 nodes Person, Topic, Endorsement

(Person) - [SENDS]->(ENDORSEMENT {description: "they are great with glazing clay and throwing on the wheel")<-[RECEIVES]-(Person)-[KNOWS]-(PERSON)
|
[FOR]
|
(Topic)

This original setup worked fine but felt a bit complicated so I simplified it a bit by removing the Endorsement and Topic nodes altogether and replacing the SENDS and RECEIVES relationships with an ENDORSES relationship that holds a 'topic' property.

so now my data model looks like this:

(a:person) -[ENDORSES {topic: 'pottery', description: "they are great with glazing clay and throwing on the wheel"]-(b:person) -[KNOWS]-(c:Person)-[KNOWS]-(d:Person)

This has worked out quite nicely as it is more simple and, with some small adjustments, I was able to get my Cypher queries to work pretty much the same as before to answer the central question in my graph: e.g.. "show me all persons 1 to 3 hops away from (d:Person) who have been endorsed for 'pottery'"

I would now like to introduce RAG search into this project to broaden the search capability. Ideally I would like to extend the search to not only include single exact words but semantically similar word and phrases. So for example if (d:Person) want's to find persons in their network that have been endorsed for "ceramics" they would find (b:Person). And, even more ambitiously, I'd like to be able to search endorsement descriptions text using the newly introduced vector indexes. So again if someone where searching for "looking for an expert in painting porcelain ceramics" the vectorization would hopefully return (b:Person) due to similarity of the description property to the query being asked.

Unfortunately, vector indexes are only supported on node properties so it looks like I'll need to go back to the more complex model I had before where an Endorsement is modeled as a node itself and not as an [ENDORSES] relationship with properties.

I know that I could use a neo4j plugin to pull in synonym list analyzer but I don't want to maintain such a thing.

I would really love the advice of the experts on this. Thank you.

1 Like

It looks like vector indices are support on relationships now as of version 5.18 is this true?