GeoPoint equivalent for a Cartesian coordinate system
<p>I have fields <code>x</code> and <code>y</code> on some search documents that correspond to Cartesian coordinates, and I'd like to perform a radial search like:</p>

<pre><code>query = '(x * x) + (y * y) &lt; 100'
</code></pre>

<p>which would equate to "find all the things less than 10m away from (0,0)"</p>

<p>Trying to use that <em>particular</em> expression fails with <code>QueryError: Failed to parse query</code>, so it seems I need to take another approach.</p>

<p><strong>Is there a built-in way to do this?</strong></p>

<p>I've seen the GeoPoint fields and <code>distance</code> query function that nearly do what I need, the problem being that my <code>x,y</code>s aren't longitude and latitude. I've thought about trying to abuse this - map all coordinates to a much smaller domain, in which the lat/long system closely approximates the Cartesian domain. This seems a little hacky though, so I'm looking for something better.</p>

<p><strong>No, there isn't.</strong></p>

<p>The search API doesn't support arbitrarily computed expressions on fields (like <code>x * x</code> in your example). What it does support is enumerated <a href="https://cloud.google.com/appengine/docs/python/search/query_strings" rel="nofollow">here</a>. Your mapping from Cartesian coordinates to lat/long fields sounds like it would be the most plausible approach.</p>

<p>(Full disclosure: I'm on the team.)</p>

python google-app-engine google-cloud-platform