Examine not indexing all the content after an index rebuild.
p

pablobarrios

9 months ago
Hello, we are using Umbraco Cloud with Umbraco v13 and the default External examine indexer. We have 8 different node types we are filtering on the search of the site. At some point on our Live site, Examine(the external index) stopped indexing everything and was only returning data from 1 node type. Those nodes are only updated by a Hangfire recurring Jobs. It worth to mention that our staging site, which have the same recurring jobs and almost the same data from the Live site, it is working perfectly fine, the Examine external index is returning all the expected results. Hence, after reading a bit, we decided to push the "red" Rebuild index button. After that, more content was coming up, but not all of them. Only the recently published one, like the ones updated by the Recurring jobs. And a couple of other that were "Save and Published" after the rebuild. The rest of the nodes that were published before the rebuild are not showing up. Does this rings a bell? Is there a way to force an import of the old published content? FWIW, the internal index returns all the expected data. And no errors were found on the logs related with Examine or "ExternalIndex". Als, the rebuild on the Umbraco interface was finished after about 2 minutes but on the logs you can see it took more than 20 minutes https://cdn.discordapp.com/attachments/1296843811300970579/1296843811728916500/Screenshot_2024-10-18_at_11.33.26.png?ex=6713c36a&is=671271ea&hm=0313e1fa3de36a83cdee8d2240c86a6f4311a7e8561b59ed4606a662b909e4af&
Issues with handling Save and Publish events in Umbraco - Need Help!
b

baristaner

about 1 year ago
Hello everyone, I am encountering some challenges with handling Save and Publish events in Umbraco, specifically using SaveAndPublishHandler class. Here are the details of my issue: **Problem Description**: I have implemented a SaveAndPublishHandler class in Umbraco to handle Saved and Published events for content items. The goal is to send an HTTP POST request to an external endpoint whenever content is saved or published with a specific ParentId (in my case, ParentId 1249). *Code : *
c#
        public SaveAndPublishHandler(IContentService contentService)
        {
            _contentService = contentService;
        }

        public void Initialize()
        {
            ContentService.Saved += ContentService_Saved;
        }

        public void Terminate()
        {
            ContentService.Saved -= ContentService_Saved;
        }

        private void ContentService_Saved(IContentService sender, SaveEventArgs<IContent> e)
        {
            foreach (var content in e.SavedEntities)
            {
                if (content.ParentId == 1249)
                {
                    var dataToSend = new { ContentId = content.Id, Title = content.Name };
                    var json = Newtonsoft.Json.JsonConvert.SerializeObject(dataToSend);
                    var contentToSend = new StringContent(json, Encoding.UTF8, "application/json");

                    using (var httpClient = new HttpClient())
                    {
                        var endpointUrl = "http://localhost:65137/umbraco/surface/UpdateApprovedAccount/UpdateApprovedAccountV2"; 

                        var response = httpClient.PostAsync(endpointUrl, contentToSend).Result;

                        var responseContent = response.Content.ReadAsStringAsync().Result;
                    }
                }
            }
        }
Composing :
c#
public void Compose(Composition composition) {
composition.Components().Append<SaveAndPublishHandler>();
}
Custom Block List Property
j

johnkhigginson

over 1 year ago
I have a custom blocklist property as part of a document type. It's very simple and only accepts one block component type. I am trying to access this property in my code. While following the umbraco documentation here: https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/block-editor/block-list-editor, It tells me it returns an IEnumerable. On that same page, it says that I can pull the value as that or BlockListModel... but with either, it returns null.
if (content.HasProperty("locations"))
{
    var locations = content.GetValue<BlockListModel>("locations");
    (or)
    var locations = content.GetValue<IEnumerable<BlockListItem>>("locations");
    ...
}
If I pull the value as a string or dynamic object, it will show as:
{"layout":{"Umbraco.BlockList":[{"contentUdi":"umb://element/74437d1928534a9287430056e140b99b"},{"contentUdi":"umb://element/382ddba6783948b28696798b3b6dad16"}]},"contentData":[{"contentTypeKey":"0285ad7f-763f-4bc5-80be-45f85f8a39e6","udi":"umb://element/74437d1928534a9287430056e140b99b","city":"Colville","stateA":"[\"WA\"]","name":"Colville Toyota"},{"contentTypeKey":"0285ad7f-763f-4bc5-80be-45f85f8a39e6","udi":"umb://element/382ddba6783948b28696798b3b6dad16","stateA":"[\"OR\"]","name":"Coos Bay Toyota","city":"Coos Bay"}],"settingsData":[]}
In converting to the BlockListModel, it has to be erroring causing it to return null; right? I need to pull the values this way because I am using those values to calculate other properties and then save that property to the document. Anyone running into this or have a solution? Is this enough info? I feel like I've tried quite a bit without success.