java - Geopoint function distance not working in FieldExpression -


i using google app engine , storing geopoints in searchable document index. when search locations using distance function example "distance(mygeopoint, geopoint(35.2, 40.5)) > 100" search returns expected documents. in returned results, want find out distance of each of mygeopoint passed in geopoint, added "distance" fieldexpression in queryoptions looks field expression doesn't evaluated , search returns field html empty value. ensure building fieldexpression correctly, tried replacing expression other expression, example (count(someotherfield)) , works , returns correct data. looks wrong usage of distance function. know wrong usage of distance function in fieldexpression? supposed work, correct? or distance functions not supported fieldexpressions?

alternatively, there other way distance between point of interest locations matching search query?

my sample code:

    // use search api     indexspec indexspec = indexspec.newbuilder().setname(             "com.mycompany").build();     index index = searchservicefactory.getsearchservice()             .getindex(indexspec);     queryoptions options = queryoptions.newbuilder()             .setlimit(100)             .setfieldstoreturn("mygeopoint")             .addexpressiontoreturn(fieldexpression.newbuilder()                     .setname("calculateddistance")                     .setexpression("distance(mygeopoint, geopoint(37.738767, -122.424037))"))             .build();     query query = query.newbuilder().setoptions(options).build("distance(mygeopoint, geopoint(37.738767, -122.424037)) < 10000");      results<scoreddocument> results = null;     try {         results = index.search(query);         (scoreddocument document : results) {             list<field> expressions = document.getexpressions();             (field e : expressions) {                 system.out.println("expression=" + e);               }         }     } catch (searchexception e) {         if (statuscode.transient_error.equals(                 e.getoperationresult().getcode())) {             results = index.search(query);                         }     } 

this see in output (instead of html, expecting calculateddistance number valid numeric value):

expression=field(name=calculateddistance, value=, type=html)


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -