umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.49k stars 2.69k forks source link

V8.0.1: Node remains in the index after being unpublished #5218

Closed hartviglarsen closed 5 years ago

hartviglarsen commented 5 years ago

I encountered an issue where a content node will remain as a document in my ExternalIndex after being unpublished, which means I will get it in my ISearchResults if I query for its NodeTypeAlias. All its values will be null if I convert it to an IPublishedContent, obviously. Since it is unpublished.

Reproduction

  1. Create a new document type and allow it as root.
  2. Create a content node with some name
  3. Check your ExternalIndex - the node is there, which is expected.
  4. Unpublish the content node and check your index again.. you will notice that it is still there.

image

The node will be gone as a document if you rebuild your index.. but you don't wanna do that everytime you unpublish. ;-)

This item has been added to our backlog AB#1533

linuselander commented 5 years ago

I can reproduce the issue that @hartviglarsen describes. I located the problem to a predicate that determines which indexes should be affected when unpublishing a node. From my tests, it seems as if it selects the InternalIndex and MemberIndex as eligible candidates for the node removal. My interpretation of the logic is that it should rather be removing the node from the ExternalIndex.

I created a pull request #5695 that solves the issue in every situation that I have managed to set up (including the exact steps described in this issue). From what I can tell, it also solves the issue described in UmbracoDocs #1737.

However, @nul800sebastiaan seems to be able to reproduce the issue even after applying my patch (as he describes in his comment to the pull request). Perhaps someone has an idea what other logic might be in play here, because I am not able to reproduce the issue with the patch applied.

azure-devops-sync[bot] commented 5 years ago

This item has been added to our backlog AB#1533

nul800sebastiaan commented 5 years ago

Fixed in https://github.com/umbraco/Umbraco-CMS/pull/5695

ElipazSoftware commented 5 years ago

Hi, After upgrade to ver 8.1.1 the ExternalIndexer still returning unpublished content.

Capture

image

Netanel

Shazwazza commented 5 years ago

Did you rebuild your index?

ElipazSoftware commented 5 years ago

Hi Shannon, Yes i rebuilt my index (ExternalIndex) few times, moreover i downloaded new 8.1.1 instance just for testing that issue and its also happens there.

Shazwazza commented 5 years ago

@ElipazSoftware which is odd since this issue wasn't present for rebuilding indexes, only for when re-indexing an individual node.

So to reproduce is just have something unpublished and rebuild your index and the item is still there? Anything else specific? does publishing and then unpublishing the node still remain? is it a variant or non variant ... basically please provide steps to reproduce.

ElipazSoftware commented 5 years ago

Ill try to clirify myself, when you unpublish node at Umbraco 8.1.1 (also have been tested on brand new freshed installation with starter kit), when unpublishing node the "ExternalIndex" didnt updated, the node still appears, as if it still publish. change take affect only after rebuiling the index. the bug is "stable" non variant. when publishing again and unpublishing the node still appear. it is the same issue mentioned at the pull request https://github.com/umbraco/Umbraco-CMS/pull/5695 we querying a lot of data through Examine, so we rebuild the index for the editors daily so unpublish content will remove from the front end. Thanks

nul800sebastiaan commented 5 years ago

Thanks @ElipazSoftware this has just led me to realize we had not merged the related pull request in to 8.1.1! 🤦‍♂️

I have just done that now and this will be released in 8.1.2, coming soon. I apologize for the confusion!

While we're at it, it is almost never necessary to rebuild indexes, can you elaborate on that, why would you need to rebuild them on a daily basis? I mean, yes, I understand that this bug forced you to, but you seemed to have other reasons?

ElipazSoftware commented 5 years ago

Hi Sebastiaan, thanks for that!!! the only reason we rebuilding the index on daily basis is due to this bug, no other reason. we just want to update the indexer about published and unpublished content changed by the editors that day. glad to know that ver 8.1.2 will resolve this issue. Thanks a lot guys