kNeighbor ldb example: written by Chao Mei