cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Modeling a nearby business recommendations data model

With spacial functions and point, it's easy to think about a graph DB for modeling a recommendations engine based on geographic location (lat,long). My questions are around - what is the standard of modeling such a system - is it as easy as I think or are there more gotcha's in terms of performance.

The standard model that comes to mind is:

(n: Business)  (m: Business)  (...: Business)

Business:
- Name
- Latitude, Longitude

For a search, simply get a cartesian product as follows:

MATCH (a:Business) 
WHERE distance(a.location, Point({latitude:$input_lat, longitude:$input_long})) < $distance_in_meters
RETURN a

This incurs a label scan based on location. We can probably index the location and make this faster but I am wondering if this is the right way to model this data set?

Are there further optimizations by:

  • making Location itself a node?
  • perhaps running cron jobs and grouping < 0.25km (as an example) business together using certain pivots?

This is probably a case of premature optimization but I am wondering if the standard model above where location is a property on a Business node is the right way to achieve the above or is there anything else?

Thanks for your help.

0 REPLIES 0
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online