Item creates successfully, visible in content tree, publised but when I try to search it by Id or other properties - I can't find it. (republishing and resaving node not working)
When I restart application - it works, node is findable. But when I change any property value, save and publish item I can't see it in appropriate page.
So, please help, what is the reason of this problem?
Does it work when you change and publish a node in the backend ?
Can you link your umbracoSettings.config to see what values these settings have. - XmlCacheEnabled - ContinouslyUpdateXmlDiskCache - XmlContentCheckForDiskChanges
Also can you check if you have sufficient security rights on the umbraco.config file in the App_Data folder
<!-- Enable / disable xml content cache --><XmlCacheEnabled>True</XmlCacheEnabled><!-- Update disk cache every time content has changed --><ContinouslyUpdateXmlDiskCache>True</ContinouslyUpdateXmlDiskCache><!-- Update in-memory cache if xml file is changed --><XmlContentCheckForDiskChanges>False</XmlContentCheckForDiskChanges>
You should use Node in your templates. The Document API will also list unpublished content and content that is in the recycle bin. Also for performance it's recommended to use Node because it works on the cache. Document API will access the database.
Programmatic node creation problem
Hi all!
I try to create umbraco node programmatic using next code:
Item creates successfully, visible in content tree, publised but when I try to search it by Id or other properties - I can't find it. (republishing and resaving node not working)
When I restart application - it works, node is findable. But when I change any property value, save and publish item I can't see it in appropriate page.
So, please help, what is the reason of this problem?
Thanks.
Hi Andrei and welcome to our :)
Is it the internal search (In Umbraco) for the newly created node that does not display the node before the application has been restarted?
/Jan
Hi Jan, thanks)
This is simple search by nodes:
HomeNode.GetDescendantNodesByType("ItemAlias").Where(x => {
var orderIdProp = x.GetProperty("orderId");
var emailProp = x.GetProperty("email");
if(orderIdProp != null && emailProp != null) {
return string.Equals(orderIdProp.Value, "orderIdValue", StringComparison.CurrentCultureIgnoreCase)&&
string.Equals(emailProp.Value, "emailValue", StringComparison.CurrentCultureIgnoreCase);
}
return false;
}).FirstOrDefault());
It finds nodes only after application restart (also if I change property value this change will be visible only after restart).
Does anybody can help me??
Hi Andrei,
It seems your cache doesn't get updated.
Does it work when you change and publish a node in the backend ?
Can you link your umbracoSettings.config to see what values these settings have.
- XmlCacheEnabled
- ContinouslyUpdateXmlDiskCache
- XmlContentCheckForDiskChanges
Also can you check if you have sufficient security rights on the umbraco.config file in the App_Data folder
Dave
Hi Dave,
Here's configuration:
Security rights: Full control.
Does it update the cache when you publish item in the backoffice ?
In my first post you can see the code I use, the last line is
So I think it should, but how to check.
All is working correctly if work with Document directly, not Node.
Does publishing from Umbraco admin work ?
You should use Node in your templates. The Document API will also list unpublished content and content that is in the recycle bin. Also for performance it's recommended to use Node because it works on the cache. Document API will access the database.
Dave
Can you try calling this method after updating document cache ?
umbraco.library.RefreshContent();
Dave
is working on a reply...