c# - Sort by distance in Lucene.net Spatial 3.0.3 -
i have application in need search geo coordinates. index building fine, using pointvectorstragegy.
i able search within circle
point p = spatialcontext.makepoint(latitude, longitude); var circle = spatialcontext.makecircle(latitude, longitude, distanceutils.dist2degrees(distance, distanceutils.earth_equatorial_radius_mi)); var args = new spatialargs(spatialoperation.iswithin, circle); var filter = strategy.makefilter(args); var records = searcher.search(booleanquery, filter, data.page * pagesize, sort);
the results fine, ordered in descending order, closest last. of now, using sort.relevance
.
does know how sort results on searching ? implement custom sorting ? there 1 ? if have code, appreciated.
i have looked around bit , tried different things. have done , works following:
sort = new sort(new sortfield("distance", sortfield.score, false));
true closest first, false otherwise.
Comments
Post a Comment