In my previous example I had this query
current_user.friends.events(:event, :rel).where("rel.admin = {admin_p} AND event.detail = {detail_p}").params(admin_p: true, detail_p: true).pluck(:event)
current_user.friends.events
brings me up to events to continue my chain, but does this work for if I already have an object that contains an array of events?
In my example, I am trying to use geocoder to pull in proximity.
So I have my user and events which are geocoded.
Geocoder can do something like this
Venue.near([40.71, 100.23], 20)
# find all objs within 20 miles
So I can essentially find all the events and store it in an object. Now can I use the neo4j query to filter that object?
e.g.
array_object(:event, :rel).where("rel.admin = {admin_p} AND event.detail = {detail_p}").params(admin_p: true, detail_p: true).pluck(:event)
Even if this works, is there an alternate way to do this?
You can't call query proxy methods on an array, so just grab the IDs of those events and filter your match accordingly.
That'll filter the user's friends' events that are in that array. We can use
neo_id
inwhere
for better performance.