Building a Dating Site With Neo4j: Part 1

DZone 's Guide to

Building a Dating Site With Neo4j: Part 1

This introductory post begins the journey of mapping potential dates as relationships and building a dating site with Neo4j.

· Database Zone ·
Free Resource

You might have already heard that Facebook is getting into the Dating business. Other dating sites have been using graphs in the past and we’ve looked at finding love using the graph before. It has been a while though, so let’s return to the topic making use of the new Date and Geospatial capabilities of Neo4j 3.4. I have to warn you though that I’ve been with Helene for almost 15 years and missed out on all this dating site fun, what I do know I blame Colin for it and some pointers from the comments section of this blog post.

Dating sites face a series of challenges, the first one is lack of users. Only two ways to fix that, the first one involves having lots of money to pay for national advertisements, the second involves word of mouth. So you dear reader have to either invest a few million dollars or join our new dating site and tell all your friends about it.

The second challenge is matching people together. Sure looks are important, but we can’t all be “5/7” or look like Seven of Nine. We want to find people who share common values, both in terms of the things they love and hate. Sometimes though, it is opposites that attract. So we’ll need a ranking system, but also the ability to flip it around and see who else is out there.

The third challenge dating sites face is messages. More specifically crude overtly sexual messages from desperate uglies to every profile. To fix this, some sites only let paying members send messages, which isn’t super effective. Other sites have decided that only women may send messages. We’re going to try something different. More on that in a bit.

The fourth challenge is getting people to keep coming back to the dating site and staying there. We’re going to combine the last two problems and try to solve them together. Dating sites can’t use the “swipe right/left” gimmick anymore, so we will try some new things in our dating site. We are going to give users the ability to “appear” in front of potential mates more than once, and to be able to make a different impression each time. So instead of focusing on profiles alone, we want our users to create content (words or pictures) to attract mates. We will let users “high five” content they like, which will allow the person who posted that content to contact the “high fiver”. But we want to instill a sense of urgency in making contact, so the “high fives” will expire after 5 days, and to avoid people spamming “high fives”, users will start with 5 “high fives” a day, and earn a “high five” every time they get a “high five”.

The fifth challenge is really really really ridiculously good looking people getting all the attention and making the “normies” feel like “uglies”. So we’ll balance things out by allowing people to “low five” content they don’t like. Especially the pretty pictures of their rivals. When a post gets a “low five”, part of it will be hidden. The more “low fives” it gets, the less of it will be shown. For example:

To avoid too much hate, a user will also start with only 5 “low fives” a day, and earn more for every “low five” they get. These “low fives” will also expire after 5 days. All this high and low fiving is just for fun, the bottom line is people just want to interact with people who message back and talk about making a date.

Alright, that’s plenty of introduction. Let’s start with an initial data model of user interactions.

The things to note are the “Date” type properties in Message, and the HIGH_FIVE, LOW_FIVE relationships. We are still going to use the “dated relationship” trick for Posts, and we will borrow the geospatial data model of a previous post. These are my initial thoughts and subject to change, we’ll see as we build this application together. What would you like to see in a dating site? If you have any suggestions, please leave a comment below.

The code is still very much in progress, but if you want to see what I have so far, take a sneak peek at this GitHub repository. I’ll walk through the interesting bigs in the next set of blog posts.

database, dating site, graph database, neo4j, tutorial

Published at DZone with permission of Max De Marzi , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}