Skip to content

Make insidePolygon compatible #555

@bidoubiwa

Description

@bidoubiwa

⚠️ related to this PR, does not need solving before it is merged #543

MeiliSearch needs a geographic point around which it will search for hits. InstantSearch provides an insideBoundingBox that is defined by two geo points.

To determine the center point of the insideBoundingBox, instantMeiliSearch uses a Geographic Midpoint Algorithm. It only handles 2 points for now.

Polygons on the contrary provided multiple geo points. Because the algorithm only handles 2 points, we can not find the geo center point needed by MeiliSearch. To implement it we need to follow the instruction provided in step B of this article.

The objective of this issue is to implement this improved algorithm in order to be compatible with the insidePolygon parameter.

  // geo-rules-adapter.ts
  if (insidePolygon) {
    console.warn(
      `instant-meilisearch: \`insidePolygon\` is not implented in instant-meilisearch.`
    )
  }

More information on how the provided data is provided can be found on instantSearch documentation.

The algorithm can be found in src/utils/geographic.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions