Convert Search Results Including umbracoMediaArticleto IPublishedContent
I'm trying to include umbracoMediaArticle in my LuceneSearchResults. When I get a search result based on a page, I can select it as IPublishedContent with:
After line 70, I have a collection of ISearchResult. Each of them includes an ID. After line 71 I try to use that ID to get IPublishedContent. It returns a collection of nulls
I found that this wasn't happening for media items I freshly added to the library. I found this wasn't happening for media items that had been added to the library that I opened and re-saved.
All of the media had been added in a different environment. I took the DB and media, brought it locally and started writing this code. Somewhere in there was an update to Umbraco 12.2.0 as well as me adding additional fields to the Umbraco Media Article doc type. Some combination of those things:
Pulling site down locally
Umbraco update
Update to doc type
Made it so I just had to save any files I wanted to fetch before fetching them. No clarity on why UmbracoHelper.media() couldn't fetch them even though they existed. I'd expect that if I added new fields and didn't save the individual media item: that the fields wouldn't be available but I didn't think it would be impossible get it as IPublishedContent.
Convert Search Results Including umbracoMediaArticleto IPublishedContent
I'm trying to include umbracoMediaArticle in my LuceneSearchResults. When I get a search result based on a page, I can select it as IPublishedContent with:
When I am trying to deal with a search result that is umbracoMediaArticle, the following results in a collection of nulls:
I swear I had this working at some point last night. Can anyone shed light on what I'm doing wrong with UmbracoHelper.Media(ID)??
After line 70, I have a collection of ISearchResult. Each of them includes an ID. After line 71 I try to use that ID to get IPublishedContent. It returns a collection of nulls
I found that this wasn't happening for media items I freshly added to the library. I found this wasn't happening for media items that had been added to the library that I opened and re-saved.
All of the media had been added in a different environment. I took the DB and media, brought it locally and started writing this code. Somewhere in there was an update to Umbraco 12.2.0 as well as me adding additional fields to the Umbraco Media Article doc type. Some combination of those things:
Made it so I just had to save any files I wanted to fetch before fetching them. No clarity on why UmbracoHelper.media() couldn't fetch them even though they existed. I'd expect that if I added new fields and didn't save the individual media item: that the fields wouldn't be available but I didn't think it would be impossible get it as IPublishedContent.
is working on a reply...