Hi, hackers.
Attached patches add missing distance operator <->(box, point).
We already have reverse operator <->(point, box), but it can't be used for kNN
search in GiST and SP-GiST. GiST and SP-GiST now support kNN searches over more
complex polygons and circles, but do not support more simple boxes, which seems
to be inconsistent.
Description of the patches:
1. Add function dist_pb(box, point) and operator <->.
2. Add <-> to GiST box_ops. Extracted gist_box_distance_helper() common for gist_box_distance() and gist_bbox_distance().
3. Add <-> to SP-GiST. Changed only catalog and tests. Box case is already checked in spg_box_quad_leaf_consistent(): out->recheckDistances = distfnoid == F_DIST_POLYP;
--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company