mongodb-labs / mongo-csharp-search

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

Feedback #5

Closed SebastianStehle closed 2 years ago

SebastianStehle commented 2 years ago

Just some feedback: I think the compound build is strange. I often use filter, must and should together and with the current syntax you have to nest it too much.

I think a syntax like this would be better:

var builder = SearchBuilders<T>.Search;

builder.Compound()
   .Must(a)
   .Must(b)
   .MustNot(c)
   .Filter(d)
   .Should(e)
   .Should(f)
   .MinimumShouldMatch(2);

or

var builder = SearchBuilders<T>.Search;

builder.Compound()
   .Must(a, b) // Params / IEnumerable
   .MustNot(c)
   .Filter(d)
   .Should(2, e, f);
dgolub commented 2 years ago

Thanks for the feedback. We'll consider reworking this during the beta phase before we go GA and commit to retaining compatibility with an interface.

MarcusSorealheis commented 2 years ago

+1 on the feedback. It's really helpful.

dgolub commented 2 years ago

This feature has now been implemented and will be included in the forthcoming Beta 2. See https://github.com/mongodb-labs/mongo-csharp-search/commit/a560dde5eb4c756886408efdb0eb4419f23d5659 and https://github.com/mongodb-labs/mongo-csharp-search/commit/78be48f637ba640ff04584943b7d5e1ac007eee6.

dgolub commented 2 years ago

Beta 2 has now been released: https://www.nuget.org/packages/MongoDB.Labs.Search/1.0.0-beta2

You can gain access to this feature, as well as the ability to specify the index name, by upgrading. Thank you very much for all of your feedback and for helping to make this a better product!