I have a series of posts stored in my database like this:
{
content: 'foo',
location: (37.423021, -122.083739)
},
{
content: 'bar',
location: (37.422473, -122.090386)
}
I also have a function between
which can calculate the distance, in miles, between two points. It works as follows:
>>> between((37.423021, -122.083739), (37.422473, -122.090386))
0.36649505427211615
I'm using this to build a predicate function valid
that would take in the document and return a boolean signifying whether or not it is valid. The function would likely look something like:
def valid(document):
return between(document.location, CONSTANT_LOCATION)
Is it possible to use this predicate as the selector for the query?