meilisearch / meilisearch-js

JavaScript client for the Meilisearch API

Home Page:https://www.meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Erro when use filter _geoBoundingBox

richardReitz opened this issue · comments

Describe the bug
I'm facing a error when I try to search with geoBoudingBox filter, but for me it doesn't make sense, I think there's nothing to compare in this filter.

"Was expecting an operation `=`, `!=`, `>=`, `>`, `<=`, `<`, `TO` or `_geoRadius` at `_geoBoundingBox([45.494181, 9.214024], [45.449484, 9.179175])`.\n1:62 _geoBoundingBox([45.494181, 9.214024], [45.449484, 9.179175])"

To Reproduce

  1. Update filterableAttributes with filter: _geo;
  2. Empty search query with filter: _geoBoudingBox;
  3. See the error.

My code

 const response = await client
      .index(`company_workshops`)
      .search('', {
      offset: 0,
      limit: 10,
      filter: [`_geoBoundingBox([${boundsNE}], [${boundsSW}])`],
     });
  return response;

Meilisearch version:
[v0.32.3]

Additional context
Using React Native 0.71.7

I'm moving this issue to the meilisearch-js repository as it is not related to meilisearch-react

Hey @richardReitz
I tried your search and it works on my side

const res = await client.index('world_cities').search('', {
    filter: ["_geoBoundingBox([45.494181, 9.214024], [45.449484, 9.179175])"]
  })
{
  hits: [
    {
      name: 'Milan',
      asciiname: 'Milan',
      _geo: [Object],
      'country code': 'IT',
      country: 'Italy',
      geonameid: '3173435',
      alternatenames: 'Lungsod ng Milano,MIL,Mailand,Mediolan,Mediolanum,Mila,Milaan,Milan,Milana,Milanas,Milano,Milanu,Milao,Milà,Milán,Miláno,Milánó,Milão,Milāna,Mílanó,Mилан,mi lan,milan,milana,milani,millano,mirano,mylan,mylanw,Милан,Милано,Мілан,מילאנו,مىلان,ميلانو,মিলান,மிலன்,มิลาน,მილანი,ミラノ,米蘭,밀라노',
      population: 1236837,
      timezone: 'Europe/Rome'
    }
  ],
  query: '',
  processingTimeMs: 1,
  limit: 20,
  offset: 0,
  estimatedTotalHits: 1
}

Could you double check your search request? It looks like your filters are duplicated.

Following your example I get the same result. See below my settings and my search with geoBoundingBox:

Captura de Tela 2023-08-04 às 16 02 36
Captura de Tela 2023-08-04 às 16 04 11

Hey @richardReitz !

Geoboundingbox was only introduced in v1.2 of Meilisearch, you are in v0.32

I updated MS and it works fine.
Ty @bidoubiwa!