Skip to content
This repository was archived by the owner on Sep 13, 2022. It is now read-only.
This repository was archived by the owner on Sep 13, 2022. It is now read-only.

search works hard-coded but not with document property #3

@matantsu

Description

@matantsu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions