Skip to content

CreateIndex with Attachment will fail #1826

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

Closed
kyakhta opened this issue Feb 11, 2016 · 2 comments
Closed

CreateIndex with Attachment will fail #1826

kyakhta opened this issue Feb 11, 2016 · 2 comments
Assignees

Comments

@kyakhta
Copy link

kyakhta commented Feb 11, 2016

 client.CreateIndex(Index, c => c
                .Mappings(m => m.Map<Docx>(p => p
                .Properties(ps => ps.Attachment(a => a.FileField(t => t.Name(e => e.Foo))))
                    .Properties(ps => ps.String(s => s.Name(o => o.Title))))));

will fail on a => a.FileField(t => t.Name(e => e.Foo) because AttachmentPropertyDescriptor.Dictionary is not initialized and has null value:

private AttachmentPropertyDescriptor<T> SetMetadataField<TDescriptor, TInterface>(Func<TDescriptor, TInterface> selector, string fieldName)
            where TDescriptor : TInterface, new()
            where TInterface : IProperty
        {
            selector.ThrowIfNull(nameof(selector));
            var type = selector(new TDescriptor());
            **this.Dictionary[fieldName] = type;**
            return this;
        }
@russcam
Copy link
Contributor

russcam commented Feb 12, 2016

Thanks for reporting @kyakhta 👍

@russcam russcam self-assigned this Feb 12, 2016
russcam added a commit that referenced this issue Feb 12, 2016
See #1826
Fix issue where FileField was mapped as "file" and not "content"
Fix issue where Language fluent method accepted a NumberPropertyDescriptor<T> instead of StringPropertyDescriptor<T>
Fix issue where ContentLength fluent method accepted a StringPropertyDescriptor<T> instead of NumberPropertyDescriptor<T>
Both of these fluent method changes overload the fluent method and mean that the lambda expression must be typed
@russcam russcam mentioned this issue Feb 12, 2016
@gmarz
Copy link
Contributor

gmarz commented Mar 1, 2016

Closed via #1827

@gmarz gmarz closed this as completed Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants