BUG: Search indexing the old page version's content

Hi there,

Environment information:
C5 version: 8.5.12
PHP: 7.3.29
MYSQL: 5.7.34

There are two issue but both are related to each other so i will explain one by one.

Main issue is with the search indexing the old block contents which are not visible on the page anymore, these content might have exists at some point but being replaced with the new contents.

I have cleared the search indexing from the CMS also tried directly from the pageSearchIndex table in DB, but these old contents still get picked up and available on the search page which is very annoying.

Somehow search indexing process picking up contents from older version instead of approved version only.

Now you might suggest to remove the old page versions from automated jobs, which i have tried and this is the second bug that this job does nothing which mean it does not remove any old version, i have tried third party plugin to remove the old version, but it does not remove the blocks which i can see in btContentLocal table.

At the moment i’m removing manually old blocks/contents from btContentLocal table so search indexing process don’t pickup the wrong contents, which is kind of working but can you fix these bugs please?

I suspect what you are seeing is orphaned blocks (also called ghosts or zombies). These are left in the database when a layout is deleted without first deleting all the blocks in the layout. Such blocks remain part of the ‘current’ page because they were part of a previous version and were never actually deleted from it. Unfortunately the way Concrete correlated that information was a one-way relationship that no longer exists, so the orphaned blocks are just left.

If you search Github you will find quite a bit of history on this issue. v9 provides a way out with the Orphaned Blocks option of the add blocks menu.


Because of the now missing one way relationship with the areas they were in, this works backwards by rendering the page in edit mode and then noting which blocks that are part of the rendered page version are missing from the list of editable blocks.

On a 5.9.12 site, the only way to get at this is to update to v9.1.3. It works most of the time, but remains prone to occasional missing object errors. Updating a v8 site to v9 is something to be cautious about. A lot depends on the addons, theme and custom blocks.

1 Like

As I have a page list that works with the page search index, I was curious. I can not reproduce this. Any updates to page content is immediately reflected in the page search index.

Hi John,

Thank you for your response, that makes complete sense.
We have quite a few custom blocks we have built for version 8, upgrade to version 9 wouldn’t work for us, we need to rewrite these blocks for version 9, which we might do at some point. i guess we until we upgrade to version 9, remove them manually from database as we are doing now will be the only solution for now.


you can replicate by removing the layout without removing the block first. this is how you can can leave orphan blocks into the Database.

If you are replacing contents then it will work just fine.

Correct. I was jus doing some simple testing to be sure the index was working properly when John came up with the orphaned block idea. Just discovered them and how to get rid of them myself a few days ago!

In our agency we have separate content teams, we build the site and hand over to them, and they do remove layouts all the time which leave these orphan blocks in the database.
Good to know that i’m doing the right thing by removing these blocks manually from the DB, until we upgrade :slight_smile: