-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix #2368 by fixing the underlying problem that scalars should be easier #2372
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
Conversation
gmarz
left a comment
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.
Is there a reason we can't overload Number() and Date() rather than introducing Scalar()?
…ier to map inside the fluent properties descriptor
37c70d7 to
f2b6400
Compare
|
@gmarz I quite like the separate The other reason i quite like With |
|
Check CLS Compliance for this |
| SetProperty(selector?.InvokeOrDefault(new KeywordPropertyDescriptor<T>().Name(field))); | ||
|
|
||
| public PropertiesDescriptor<T> Scalar(Expression<Func<T, string>> field, Func<TextPropertyDescriptor<T>, ITextProperty> selector) => | ||
| SetProperty(selector?.InvokeOrDefault(new TextPropertyDescriptor<T>().Name(field))); |
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.
This should do the same thing as string inference on automapping i.e. add a keyword multi_field
|
Add |
|
@forloop I added IEnumerable overloads with my last commit. Mind giving this a final review? |
russcam
left a comment
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.
Just one comment, otherwise LGTM
|
|
||
| #pragma warning disable CS3001 // Argument type is not CLS-compliant | ||
| public IProperty Scalar(Expression<Func<T, int>> field, Func<NumberPropertyDescriptor<T>, INumberProperty> selector) => | ||
| selector?.InvokeOrDefault(new NumberPropertyDescriptor<T>().Name(field).Type(NumberType.Integer)); |
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 think all of these should be
selector.InvokeOrDefault(...)
if selector is null, we want to return the default, but the null conditional on the .InvokeOrDefault() will return null if selector is null.
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.
yep! good catch will fix these now.
|
merged to |
… be easier (elastic#2372) * fix elastic#2368 by fixing the underlying problem that scalars should be easier to map inside the fluent properties descriptor * remove compiler warnings * Add IEnumerable overloads * selector?.InvokeOrDefault => selector.InvokeOrDefault
... to map inside the fluent properties descriptor