mongodb-labs / mongo-csharp-search

C# driver extension providing support for Atlas Search
Apache License 2.0
17 stars 1 forks source link

Don't see GeoJsonPoint for Near #13

Closed LarryZhou closed 2 years ago

LarryZhou commented 2 years ago

I was looking at the Near implementation, and couldn't find a way to pass a Geo point to the 2nd parameter (origin). It appears to only accept either Number (double/int/long) or DateTime. How do I do a search near a Geo point? Did I miss something there? Thx.

Here is what I was trying to do:

var point = new GeoJsonPoint<GeoJson2DGeographicCoordinates>(new GeoJson2DGeographicCoordinates(-161.323242, 22.512557));
var scoreBuilder = new ScoreDefinitionBuilder<WaypointEntity>();

var filter = SearchBuilders<WaypointEntity>.Search.Near(x => x.Geometry, point, 1000, scoreBuilder.Constant(1));
dgolub commented 2 years ago

Thank you for bringing this omission to our attention. I've filed an internal ticket, and we'll add support for this in a coming release, probably either 1.0.1 or 1.1.0, after the 1.0 GA.

LarryZhou commented 2 years ago

David,

Thx for the quick reply. Just wonder whether you have a timeline for the fix to be released?

Larry

dgolub commented 2 years ago

Hopefully within the next month or two. If time permits, I'm hoping to do the fix this weekend. If you need it urgently, I can put out a beta release of 1.0.1 so that you can get it before it's finalized.

LarryZhou commented 2 years ago

If you could do a beta release to include the fix, it'll be much appreciated. Currently my company (Polaris) is working closely with MongoDB to do a migration from Community version 3.6 to Atlas cloud (5.x), and would love to get this to showcase the comprehensive search capacity of Atlas to the stakeholders.

dgolub commented 2 years ago

The beta is now available for download whenever it's convenient for you: https://www.nuget.org/packages/MongoDB.Labs.Search/1.0.1-beta1

LarryZhou commented 2 years ago

Worked perfectly. Thx.

dgolub commented 2 years ago

Excellent!