Prev |  | Next

## 7.7. Find people based on similar favorites

Figure 7.6. Graph

To find out the possible new friends based on them liking similar things as the asking person, use a query like this:

Query.

    START me=node:node_auto_index(name = "Joe")
    MATCH me-[:favorite]->stuff<-[:favorite]-person
    WHERE NOT(me-[:friend]-person)
    RETURN person.name, count(stuff)
    ORDER BY count(stuff) DESC

The list of possible friends ranked by them liking similar stuff that are not yet friends is returned.

Result

person.name | count(stuff)
--- | ---
2 rows
0 ms
`"Derrick"` | `2`
`"Jill"` | `1`

Copyright © 2013 Neo Technology

Prev | Up | Next
| Home |