I'm writing a dating app where members can specify how far away they're willing to travel for a date. Each :Person object contains a location and distance property. The location property is a Point object and the distance property is an integer that represents distances in miles (10, 15, 30, 50, 100, 250, 500, 999, 1001). The 999 property represents that the member is open to dates "Anywhere" and 1001 equates to only in their state/country.
I have the query working for the miles entries (10-500), however I'm trying to figure out how to do the 999 and 1001.
My current query is:
MATCH (me:Person {userId: $userId})
MATCH (p:Person) WHERE distance(me.location, p.location) < p.distance * $distanceMultiplier
AND distance(me.location, p.location) < $distance * $distanceMultiplier
If the person doing the query has their distance set as Anywhere, I simply do not include the AND clause. I can easily change which clauses get added via the API code to handle the user's settings for the person who is calling the method. My problem is being able to get properties from the result set and possibly change the AND clause based on it. For instance:
If the person making the query is open to anywhere, Person objects for people that are in a different Country/State that don't want to go that far should not show up. In order to do that, I would need to look into the Person object to get their distance property and then if that Person object has a distance of 999 or 1000, then change the query for that.
I hope this makes sense. :)
*** Edit ***
Just want to add that if I'm going about this the wrong way and need to change the schema, I can do that.