redis icon indicating copy to clipboard operation
redis copied to clipboard

Adonisjs/[email protected] do not have geo related functions

Open dinesh-suthar-cdp opened this issue 1 year ago • 0 comments

Package version

7.3.4

Describe the bug

I am running the redis' geo functions like georadius() in my code but it is giving me error:

This is my controller code:

import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
import Redis from '@ioc:Adonis/Addons/Redis'

export default class RedisController {
    public async makeConnection({ request }: HttpContextContract) {

        
        const radius = 50  // Specify your radius in meters
      const options = ['WITHDIST', 'WITHCOORD', 'ASC', 'COUNT', '1']

      // Use GEORADIUS command to find the nearest point
      const results = await Redis.georadius('track_wr', 72.8273470257908, 18.9345157490157, radius, 'm', ...options)

      console.log(results);
    }

Error: "message": "Redis_1.default.georadius is not a function",

upon investigating, I found my ioMethods.ts file do not have following array elements:

'geoadd', 'geodist', 'geodistBuffer', 'geohash', 'geohashBuffer', 'geopos', 'georadius', 'georadius_ro', 'georadiusbymember', 'georadiusbymember_ro', 'geosearch', 'geosearchstore',

I

Reproduction repo

No response

dinesh-suthar-cdp avatar Mar 27 '24 11:03 dinesh-suthar-cdp