-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSHARP-5429: Support strings with range operator for atlas search #1588
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks good! Some smaller comments
/// <param name="value">The value.</param> | ||
/// <returns>StringSearchRange.</returns> | ||
public static StringSearchRange Lt(this StringSearchRange stringSearchRange, string value) | ||
=> new(stringSearchRange.Min, max: value, stringSearchRange.IsMinInclusive, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better add the name of the last parameter name, so it's easier to understand what's happening here.
/// <param name="value">The value.</param> | ||
/// <returns>StringSearchRange.</returns> | ||
public static StringSearchRange Lte(this StringSearchRange stringSearchRange, string value) | ||
=> new(stringSearchRange.Min, max: value, stringSearchRange.IsMinInclusive, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as before
@@ -611,6 +611,33 @@ public SearchDefinition<TDocument> Range<TField>( | |||
SearchScoreDefinition<TDocument> score = null) | |||
where TField : struct, IComparable<TField> => | |||
new RangeSearchDefinition<TDocument, TField>(path, range, score); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're missing a constructor that takes Expression<Func<TDocument, IEnumerable<TField>>>
for path
, and a relative test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already added this in another PR that was merged. I just need to rebase my current PR to show that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing something but I mean another constructor with this signature:
public SearchDefinition<TDocument> Range<TField>(
Expression<Func<TDocument, IEnumerable<TField>>> path,
StringSearchRange range,
SearchScoreDefinition<TDocument> score = null)
This is so that the constructor can be used when the field is an IEnumerable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I thought you were mentioning it for other Range methods that use SearchRange
. So for the new Range overloads using StringSearchRange
, we don't need another overload with IEnumerable<TField>
since TField
isn't used anywhere else for the parameters. So if a user uses a field that is an IEnumerable
, TField
would be an IEnumerable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad! You're right, in this case we got no parameters.
b75f463
to
8fa028b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, let's just maybe talk about it during next standup to be sure we all agree this should be merged now
No description provided.