appengine-search-python-java
appengine-search-python-java copied to clipboard
search works hard-coded but not with document property
I am trying to implement something similar to the example from google.
the example shows how to search for nearby points with the query:
distance(location , geopoint(11.1 , 12.3)) < 100000
I am trying to build an app where a professional can choose a max work radius , above which he will not get job offers , so just like the location
field of the document , I put a max_radius
NumberField
which is going to be different for each document.
this is the code:
fields = [search.GeoField(name='location', value=search.GeoPoint(11.2, 12.4)),
search.NumberField(name='max_radius', value=453786435)]
doc = search.Document(doc_id='example', fields=fields)
search.Index('Professional').put(doc)
print search.Index('Professional').search('distance(location , geopoint(11.1 , 12.3)) < max_radius')
getting:
RuntimeError: ValueError('could not convert string to float: max_radius',)
when the query is replaced to distance(location , geopoint(11.1 , 12.3)) < 1000000
, it works as expected.