src/TNTGeoSearch.php
public function findNearest($currentLocation, $distance, $limit = 10)
    {
        $startTimer = microtime(true);

        $res = $this->buildQuery($currentLocation, $distance, $limit);

        $stopTimer = microtime(true);

        return [
            'ids'            => $res->pluck('doc_id'),
            'distances'      => $res->pluck('distance'),
            'hits'           => $res->count(),
            'execution_time' => round($stopTimer - $startTimer, 7) * 1000 ." ms"
        ];
    }
public function findNearest($currentLocation, $distance, $limit = 10)
    {
        $startTimer = microtime(true);

        $res = $this->buildQuery($currentLocation, $distance, $limit);

        $stopTimer = microtime(true);

        return [
            'ids'            => $res->pluck('doc_id'),
            'distances'      => $res->pluck('distance'),
            'hits'           => $res->count(),
            'execution_time' => round($stopTimer - $startTimer, 7) * 1000 ." ms"
        ];
    }
public function findNearest ( $ currentLocation , $ distance , $ limit = 10 ) { $ startTimer = microtime ( true ) ; $ res = $ this -> buildQuery ( $ currentLocation , $ distance , $ limit ) ; $ stopTimer = microtime ( true ) ; return [ 'ids' => $ res -> pluck ( 'doc_id' ) , 'distances' => $ res -> pluck ( 'distance' ) , 'hits' => $ res -> count ( ) , 'execution_time' => round ( $ stopTimer - $ startTimer , 7 ) * 1000 . " ms" ] ; }
Distance is in KM
Distance is in KM