Skip to content

Conversation

Strift
Copy link
Collaborator

@Strift Strift commented Oct 13, 2025

Pull Request

Related issue

Fixes #1412

What does this PR do?

  • extract insidePolygon from instantSearch params
  • add tests that params are formatted properly for sending to Meilisearch
  • add tests to clarify how _geo and _geojson interact
  • update documentation

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

  • New Features

    • Added insidePolygon for polygon-based geo filtering; valid polygons override bounding boxes and “around” parameters.
    • Added optional _geojson Point support so GeoJSON-point documents can be queried.
  • Bug Fixes / Stability

    • Invalid polygons (fewer than three points or invalid coords) are ignored to ensure stable behavior.
  • Tests

    • Added geo-focused tests covering polygon, bounding box, and radius behaviors.
  • Documentation

    • Updated docs with insidePolygon usage and notes on enabling _geojson.

@Strift Strift self-assigned this Oct 13, 2025
@Strift Strift added the enhancement New feature or request label Oct 13, 2025
Copy link

changeset-bot bot commented Oct 13, 2025

⚠️ No Changeset found

Latest commit: 922b3b1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

coderabbitai bot commented Oct 13, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds insidePolygon support: adaptGeoSearch now recognizes and validates polygon coordinates to emit a _geoPolygon filter (taking precedence over other geo params). Wires insidePolygon through the search-params adapter, updates tests and test types to include optional _geojson, updates geosearch integration tests and docs, and makes small playground adjustments.

Changes

Cohort / File(s) Summary
Geo rules adapter implementation
packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts
Added insidePolygon handling in adaptGeoSearch: validates ≥3 [lat,lng] pairs (filters out NaN), formats points, returns a _geoPolygon filter immediately (takes precedence). Signature updated to accept insidePolygon.
Search params integration
packages/instant-meilisearch/src/adapter/search-request-adapter/search-params-adapter.ts
addGeoSearchFilter now reads insidePolygon from searchContext and passes it to adaptGeoSearch.
Adapter unit tests for geo rules
packages/instant-meilisearch/src/adapter/search-request-adapter/__tests__/geo-rules.test.ts
Added tests: polygon formatting for triangle/quadrilateral, precedence of insidePolygon over insideBoundingBox/around*, and ignoring invalid polygons (<3 points).
Integration geosearch tests
packages/instant-meilisearch/__tests__/geosearch.test.ts
Index setup updated to include _geojson in filterableAttributes; added tests for insidePolygon inclusion/exclusion, behavior with documents missing _geojson, aroundRadius with _geojson-only docs, and cleanup of created test docs.
Test assets/types
packages/instant-meilisearch/__tests__/assets/utils.ts
Extended exported City type with optional _geojson?: { type: 'Point'; coordinates: [number, number] }.
Documentation
packages/instant-meilisearch/README.md
Documented insidePolygon usage, examples, precedence rules, and note to add _geojson to index filterableAttributes; added code sample and geosearch link.
Playground HTML
playgrounds/geo-javascript/index.html
Removed/hidden the visible maps div (replaced with a comment).
Playground app changes
playgrounds/geo-javascript/src/app.js
Switched to import.meta.env.GOOGLE_API, renamed index to world_cities_geojson, updated Meilisearch host to edge.meilisearch.com, adjusted sortBy references, and commented out geoSearch widget block.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as InstantSearch Widget
  participant SPA as search-params-adapter
  participant GRA as geo-rules-adapter
  participant MS as Meilisearch

  UI->>SPA: build search params (insidePolygon, insideBoundingBox, around*)
  SPA->>GRA: adaptGeoSearch({ insidePolygon, ... })
  alt insidePolygon valid (>=3 points)
    note right of GRA #DFF2E1: Validate points, strip invalid\nFormat as ["lat, lng", ...]
    GRA-->>SPA: return _geoPolygon filter
  else no valid polygon
    note right of GRA #FFF4E5: Fallback to aroundLatLng/aroundRadius\nor insideBoundingBox (existing logic)
    GRA-->>SPA: return other geo filter or undefined
  end
  SPA->>MS: search(query, filters including _geoPolygon if present)
  MS-->>SPA: hits
  SPA-->>UI: results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I traced a carrot-shaped polygon this eve,
Hopped along lat-lngs—no tricks up my sleeve.
Three points or more, and the filter’s set,
Brussels appears; Paris I forget.
I nibble results, delighted and spry—🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The pull request includes updates to playground files such as hiding the map element, changing environment access, renaming indexes, and commenting out map widgets which are not part of the insidePolygon support objectives and therefore fall outside the scope of issue #1412. Please remove or isolate the playground and environment configuration changes into a separate pull request or ensure they directly support the insidePolygon feature to keep this PR focused on its stated objectives.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the primary enhancement by indicating that support for the insidePolygon filter is being added to the geo search functionality, directly reflecting the main change implemented in the PR.
Linked Issues Check ✅ Passed The changes fully implement the tasks outlined in issue #1412 by updating the geo-rules-adapter to handle the insidePolygon parameter, adding related tests, updating the connector code to pass insidePolygon through, and refreshing the documentation and code samples accordingly.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (1)

19-22: Consider adding precision control for consistency.

Unlike the existing aroundLatLng handling (line 35) which uses .toFixed(5) to control floating-point precision, the polygon coordinates don't limit decimal places. While not critical, this inconsistency could lead to unexpected filter strings with high-precision input.

Apply this diff for consistency:

-        const lat = Number.parseFloat(String(pair[0]))
-        const lng = Number.parseFloat(String(pair[1]))
+        const lat = Number.parseFloat(String(pair[0])).toFixed(5)
+        const lng = Number.parseFloat(String(pair[1])).toFixed(5)
         if (Number.isNaN(lat) || Number.isNaN(lng)) return null
-        return `[${lat}, ${lng}]`
+        return `[${Number(lat)}, ${Number(lng)}]`

Note: This mirrors the precision handling used for aroundLatLng at line 35.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 043669a and ec89b9f.

📒 Files selected for processing (5)
  • packages/instant-meilisearch/__tests__/assets/utils.ts (1 hunks)
  • packages/instant-meilisearch/__tests__/geosearch.test.ts (2 hunks)
  • packages/instant-meilisearch/src/adapter/search-request-adapter/__tests__/geo-rules.test.ts (1 hunks)
  • packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (2 hunks)
  • packages/instant-meilisearch/src/adapter/search-request-adapter/search-params-adapter.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
packages/instant-meilisearch/__tests__/geosearch.test.ts (1)
packages/instant-meilisearch/__tests__/assets/utils.ts (1)
  • City (225-230)
packages/instant-meilisearch/src/adapter/search-request-adapter/__tests__/geo-rules.test.ts (1)
packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (1)
  • adaptGeoSearch (3-65)
packages/instant-meilisearch/src/adapter/search-request-adapter/search-params-adapter.ts (1)
packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (1)
  • adaptGeoSearch (3-65)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: autocomplete-client end-to-end-tests
  • GitHub Check: instant-meilisearch end-to-end-tests
🔇 Additional comments (8)
packages/instant-meilisearch/__tests__/assets/utils.ts (1)

107-222: LGTM! GeoJSON support correctly added to test data.

The implementation correctly adds _geojson fields alongside existing _geo fields, properly following the GeoJSON Point format with coordinates in [longitude, latitude] order. The optional type annotation is appropriate since not all documents may have GeoJSON data.

Also applies to: 229-229

packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (1)

14-30: Polygon precedence correctly implemented.

The logic properly prioritizes insidePolygon over other geo filters and includes robust validation:

  • Filters invalid coordinate pairs
  • Ensures at least 3 valid points for a valid polygon
  • Short-circuits to avoid unnecessary processing
packages/instant-meilisearch/src/adapter/search-request-adapter/search-params-adapter.ts (1)

207-222: LGTM! Parameter correctly threaded through.

The insidePolygon parameter is properly destructured from the search context and passed to adaptGeoSearch, maintaining consistency with how other geo parameters are handled.

packages/instant-meilisearch/src/adapter/search-request-adapter/__tests__/geo-rules.test.ts (1)

85-136: Excellent test coverage for polygon functionality.

The test suite comprehensively validates:

  • Polygon conversion for different shapes (triangle, quadrilateral)
  • Precedence behavior ensuring insidePolygon takes priority over insideBoundingBox and radius-based filters
  • Graceful handling of invalid input with fewer than 3 points

The expected filter format _geoPolygon([lat, lng], ...) correctly matches Meilisearch's syntax.

packages/instant-meilisearch/__tests__/geosearch.test.ts (4)

14-14: Filterable attributes correctly expanded for polygon support.

Adding '_geojson' to the filterable attributes alongside '_geo' enables polygon-based geo search. This aligns with Meilisearch v1.22.0's polygon support requirements.


112-133: LGTM! Polygon search test validates expected behavior.

The test correctly verifies that documents within the defined polygon (Brussels) are included while documents outside (Paris) are excluded, demonstrating that the insidePolygon parameter is properly translated into a working _geoPolygon filter.


135-168: Good coverage of _geojson field requirement.

This test correctly validates an important constraint: the _geoPolygon filter in Meilisearch only matches documents with the _geojson field. Documents with only _geo are properly excluded from polygon searches. The test includes appropriate cleanup of the test document.


170-202: Validates interoperability between _geo and _geojson fields.

This test confirms that radius-based geo searches (using _geoRadius) work with documents that have only _geojson fields, demonstrating good backward compatibility in Meilisearch's geo search implementation. The test includes proper cleanup.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (1)

14-30: Consider: Coordinate precision consistency.

For consistency with aroundLatLng processing (line 35, which uses .toFixed(5)), consider whether polygon coordinates should also be formatted to 5 decimal places. However, this may not be necessary if Meilisearch handles precision internally.

If desired for consistency:

 const formattedPoints = insidePolygon
   .map((pair) => {
     if (!Array.isArray(pair) || pair.length < 2) return null
     const lat = Number.parseFloat(String(pair[0]))
     const lng = Number.parseFloat(String(pair[1]))
     if (Number.isNaN(lat) || Number.isNaN(lng)) return null
-    return `[${lat}, ${lng}]`
+    return `[${lat.toFixed(5)}, ${lng.toFixed(5)}]`
   })
   .filter((pt): pt is string => pt !== null)
packages/instant-meilisearch/__tests__/geosearch.test.ts (1)

135-171: Document _geojson requirement for polygon geosearch
Polygon filters (insidePolygon / _geoPolygon) only work with GeoJSON shapes (_geojson). Update the geosearch docs (README or API reference) to note that documents must include a valid _geojson field to be returned in polygon searches (you can retain _geo for distance-based sorting).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 043669a and 1e84be5.

📒 Files selected for processing (5)
  • packages/instant-meilisearch/__tests__/assets/utils.ts (1 hunks)
  • packages/instant-meilisearch/__tests__/geosearch.test.ts (2 hunks)
  • packages/instant-meilisearch/src/adapter/search-request-adapter/__tests__/geo-rules.test.ts (1 hunks)
  • packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (2 hunks)
  • packages/instant-meilisearch/src/adapter/search-request-adapter/search-params-adapter.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
packages/instant-meilisearch/src/adapter/search-request-adapter/search-params-adapter.ts (1)
packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (1)
  • adaptGeoSearch (3-65)
packages/instant-meilisearch/__tests__/geosearch.test.ts (1)
packages/instant-meilisearch/__tests__/assets/utils.ts (1)
  • City (285-290)
packages/instant-meilisearch/src/adapter/search-request-adapter/__tests__/geo-rules.test.ts (1)
packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (1)
  • adaptGeoSearch (3-65)
🔇 Additional comments (8)
packages/instant-meilisearch/src/adapter/search-request-adapter/search-params-adapter.ts (1)

207-231: LGTM! Clean parameter threading.

The addition of insidePolygon to the destructuring and its pass-through to adaptGeoSearch correctly wires the new polygon geo-search capability. The change is minimal and aligns with the updated function signature.

packages/instant-meilisearch/src/adapter/search-request-adapter/__tests__/geo-rules.test.ts (1)

85-136: LGTM! Comprehensive test coverage for polygon geo-search.

The new test suite thoroughly validates insidePolygon behavior:

  • Basic functionality with triangle and quadrilateral polygons
  • Precedence over insideBoundingBox and around* parameters
  • Graceful handling of invalid input (< 3 points)

The tests align well with the implementation and cover both happy paths and edge cases.

packages/instant-meilisearch/__tests__/assets/utils.ts (2)

285-290: LGTM! Correct GeoJSON Point structure.

The addition of the optional _geojson field correctly models a GeoJSON Point with coordinates in [lng, lat] order, which is the GeoJSON standard. The optional nature maintains backward compatibility with existing tests.


107-282: Coordinate consistency confirmed. All entries in geoDataset have matching _geo and _geojson coordinates.

packages/instant-meilisearch/__tests__/geosearch.test.ts (3)

14-14: LGTM! Necessary filterable attribute addition.

Adding '_geojson' to the filterable attributes is required for polygon-based geo queries to function properly in Meilisearch.


112-133: LGTM! Well-structured polygon geo-search test.

The test correctly validates insidePolygon functionality by:

  • Using a triangle polygon around the Brussels area
  • Confirming Brussels is included in results
  • Confirming Paris (far outside) is excluded

The polygon coordinates follow the [lat, lng] convention used by InstantSearch.


173-205: LGTM! Good test coverage for _geojson compatibility.

This test confirms that radius-based geo queries work with _geojson-only documents, demonstrating interoperability between the two geo field formats. Proper cleanup is included.

packages/instant-meilisearch/src/adapter/search-request-adapter/geo-rules-adapter.ts (1)

14-30: LGTM! Robust polygon validation and precedence logic.

The implementation correctly:

  • Validates polygon structure (array with ≥3 coordinate pairs)
  • Parses and validates each coordinate pair, filtering invalid entries
  • Ensures at least 3 valid points remain after validation
  • Returns immediately to establish precedence over other geo filters
  • Formats output consistent with existing _geoRadius and _geoBoundingBox filters

The validation is thorough with appropriate NaN checks and defensive array length checks.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/instant-meilisearch/README.md (2)

794-794: Enhance documentation with reference link and clarify settings configuration.

The insidePolygon documentation is clear, but could be improved:

  1. Add a link to Meilisearch's documentation on _geojson for users who need to understand how to configure their index
  2. Consider adding a brief note that the filterableAttributes setting must be configured via the Meilisearch API or dashboard (before using this parameter)

Apply this diff to add the documentation link:

-- `insidePolygon`: Filters search results to only include documents whose coordinates fall within a specified polygon. This parameter accepts an array of coordinate pairs `[[lat, lng], [lat, lng], ...]` that define the polygon vertices (minimum 3 points required). When `insidePolygon` is specified, it takes precedence over `insideBoundingBox` and `around*` parameters. **Note**: This feature requires `_geojson` to be added to your Meilisearch index's `filterableAttributes` setting.
+- `insidePolygon`: Filters search results to only include documents whose coordinates fall within a specified polygon. This parameter accepts an array of coordinate pairs `[[lat, lng], [lat, lng], ...]` that define the polygon vertices (minimum 3 points required). When `insidePolygon` is specified, it takes precedence over `insideBoundingBox` and `around*` parameters. **Note**: This feature requires `_geojson` to be added to your Meilisearch index's [`filterableAttributes` setting](https://www.meilisearch.com/docs/reference/api/settings#filterable-attributes) (configured via the Meilisearch API or dashboard before performing searches).

821-839: Clear and well-structured example.

The usage example effectively demonstrates the insidePolygon feature with:

  • Clear comments about the prerequisite settings
  • Proper coordinate array format
  • Valid polygon (3 vertices forming a triangle)

One minor improvement: Consider clarifying that the filterableAttributes setting must be configured using the Meilisearch settings API or dashboard before using this parameter, as it cannot be set directly in the InstantSearch configuration.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e84be5 and 8672d57.

📒 Files selected for processing (1)
  • packages/instant-meilisearch/README.md (2 hunks)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/instant-meilisearch/README.md (1)

794-794: Improve readability by breaking up the long paragraph.

The documentation for insidePolygon is comprehensive but presented as a single 300+ character line, which impacts readability. Consider breaking it into a bulleted list.

Apply this diff to improve readability:

-- `insidePolygon`: Filters search results to only include documents whose coordinates fall within a specified polygon. This parameter accepts an array of coordinate pairs `[[lat, lng], [lat, lng], ...]` that define the polygon vertices (minimum 3 points required). When `insidePolygon` is specified, it takes precedence over `insideBoundingBox` and `around*` parameters. Polygon filters require documents to contain a valid `_geojson` field with [GeoJSON format](https://geojson.org/). Documents without `_geojson` will not be returned in polygon searches, even if they have `_geo` coordinates.
+- `insidePolygon`: Filters search results to only include documents whose coordinates fall within a specified polygon.
+  - Accepts an array of coordinate pairs: `[[lat, lng], [lat, lng], ...]` (minimum 3 points required)
+  - Takes precedence over `insideBoundingBox` and `around*` parameters when specified
+  - Requires documents to contain a valid `_geojson` field with [GeoJSON format](https://geojson.org/)
+  - Documents without `_geojson` will not be returned in polygon searches, even if they have `_geo` coordinates
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8672d57 and ba24fb2.

📒 Files selected for processing (3)
  • packages/instant-meilisearch/README.md (2 hunks)
  • playgrounds/geo-javascript/index.html (1 hunks)
  • playgrounds/geo-javascript/src/app.js (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • playgrounds/geo-javascript/index.html
🧰 Additional context used
🧬 Code graph analysis (1)
playgrounds/geo-javascript/src/app.js (4)
playgrounds/javascript/src/app.js (1)
  • search (4-13)
packages/instant-meilisearch/src/client/instant-meilisearch-client.ts (1)
  • instantMeiliSearch (46-212)
playgrounds/node-env/index.js (1)
  • instantMeiliSearch (4-8)
playgrounds/react/src/App.jsx (1)
  • instantMeiliSearch (18-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: instant-meilisearch end-to-end-tests
🔇 Additional comments (4)
playgrounds/geo-javascript/src/app.js (3)

5-5: LGTM: Correct environment variable access for modern bundlers.

The change from process.env.GOOGLE_API to import.meta.env.GOOGLE_API is appropriate for Vite or other modern bundlers that use import.meta.env for environment variables.


11-11: LGTM: Index name updated consistently.

The index name change from world_cities to world_cities_geojson aligns with the PR's addition of polygon support and is consistently applied across all references.

Also applies to: 23-31


13-13: Verify Meilisearch host and index accessibility. A direct check against https://edge.meilisearch.com/indexes/world_cities_geojson with the existing API key returned 401. Ensure that edge.meilisearch.com is the correct host, the API key has access, and the world_cities_geojson index exists there.

packages/instant-meilisearch/README.md (1)

820-834: LGTM: Clear and helpful polygon filtering example.

The code example demonstrates insidePolygon usage effectively, following the existing documentation patterns. The coordinates form a valid triangle around Brussels (matching the test data), and the reference to the geosearch documentation provides users with additional context.

Comment on lines 40 to 48
// instantsearch.widgets.geoSearch({
// container: '#maps',
// googleReference: window.google,
// initialZoom: 7,
// initialPosition: {
// lat: 50.655250871381355,
// lng: 4.843585698860502,
// },
// }),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: geoSearch widget should not be commented out.

The geoSearch widget is completely commented out in this geo-javascript playground. This is problematic because:

  1. This playground is specifically for demonstrating geosearch functionality
  2. The PR adds insidePolygon support, which should be demonstrated here
  3. Users rely on this playground as a working example

The widget should be active to demonstrate the new polygon filtering feature.

Apply this diff to restore and enhance the geoSearch widget:

-      // instantsearch.widgets.geoSearch({
-      //   container: '#maps',
-      //   googleReference: window.google,
-      //   initialZoom: 7,
-      //   initialPosition: {
-      //     lat: 50.655250871381355,
-      //     lng: 4.843585698860502,
-      //   },
-      // }),
+      instantsearch.widgets.configure({
+        insidePolygon: [
+          [50.8466, 4.35],
+          [50.75, 4.1],
+          [50.65, 4.5],
+        ],
+      }),
+      instantsearch.widgets.geoSearch({
+        container: '#maps',
+        googleReference: window.google,
+        initialZoom: 7,
+        initialPosition: {
+          lat: 50.655250871381355,
+          lng: 4.843585698860502,
+        },
+      }),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// instantsearch.widgets.geoSearch({
// container: '#maps',
// googleReference: window.google,
// initialZoom: 7,
// initialPosition: {
// lat: 50.655250871381355,
// lng: 4.843585698860502,
// },
// }),
instantsearch.widgets.configure({
insidePolygon: [
[50.8466, 4.35],
[50.75, 4.1],
[50.65, 4.5],
],
}),
instantsearch.widgets.geoSearch({
container: '#maps',
googleReference: window.google,
initialZoom: 7,
initialPosition: {
lat: 50.655250871381355,
lng: 4.843585698860502,
},
}),
🤖 Prompt for AI Agents
playgrounds/geo-javascript/src/app.js around lines 40 to 48: the geoSearch
widget is fully commented out which breaks this geo demo and hides the new
insidePolygon feature; uncomment the geoSearch widget block so it is
instantiated, keep container: '#maps', googleReference: window.google,
initialZoom and initialPosition, and enhance the widget config to demonstrate
polygon filtering by adding an example insidePolygon parameter (provide a sample
polygon coordinate array or enable the insidePolygon option supported by the
widget) so the playground shows the new insidePolygon behavior.

@Strift Strift marked this pull request as draft October 21, 2025 07:39
@curquiza
Copy link
Member

@dureuill I know JS is not your main language, but it's more a review for the geosearch part, if relevant, to help Bruno who has less context on Geosearch. Tell me if not at all.

@Strift
Copy link
Collaborator Author

Strift commented Oct 21, 2025

The feature is ready but I need to do #1415 to update the geosearch playground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

instant-meilisearch: add insidePolygon support to geosearch

2 participants