[5.0] Smart Search: Only add published taxonomies #39961
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request for Issue #36980.
Summary of Changes
While fixing the issue of #39944, it became clear that not only the content in the index had the issue that you couldn't reliably unpublish it, but that also the taxonomies had an issue with its state. Taxonomies tried to copy over the state from their input data and used that as state for the taxonomie itself. That means, that unpublished categories would have had been added as unpublished taxonomies to a content item. Now if you wanted to prevent a taxonomie to show up in the frontend, you were able to unpublish (or publish) the taxonomie, thus unsyncing the taxonomie and its datasource. You basically were able to set a category to unpublished, index an article from that category and in the resulting taxonomie, you would then be able to enable that again.
At the same time, the state of the taxonomie was changed back to its datasource when the original content item was indexed again. So you unpublished a taxonomie, then edited an article and those taxonomies would be published again. This PR changes this now.
With this PR, Taxonomies now have their own, exclusive state and are either published or unpublished and that state is preserved across several indexing runs. At the same time, taxonomies are only added to the index when they are published, thus having state = 1. Since only published taxonomies show up in the frontend anyway, this doesn't change anything to existing sites.
Furthermore, this PR ensures that languages and access levels are set properly from the datasource and not just from the given method inputs. This specifically means, that the specific language of a category does not overwrite the "all" language of its parent category for example.
Testing Instructions
Actual result BEFORE applying this Pull Request
Before the patch, the first category would also have the language "english". After reindexing, the unpublished category in the Content Maps is published again. After the second reindexing, the unpublished category and all its children is still listed as a taxonomy.
Expected result AFTER applying this Pull Request
After the patch, the first category has the correct language "all". After reindexing, the unpublished in Content maps is still unpublished. After the second reindexing, the unpublished category and all its children are not listed as taxonomies anymore.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed