Hey everyone,
I rarely work with joomla, but ran into this issue.
The issue also seems to affect the filter functionality (but I had no time to properly test this) and might be related to issues #38355, #40068 and #40069.
At least for the wrong API return the cause seems quite clear (see below).
Request any article via the webservice/API that has tags assigned to it.
The ids and names of the tags are/might be mismatched (could have been caused by re-sorting/changes to the tags hierarchy/nesting).
This is the basic tag structure:
And an article with tags "M" (ID 2), "T" (ID 3) and "D" (ID 26) assigned to it.
Result having matching IDs/names
...
state: 1,
tags: {
2: "M...",
3: "T...",
26: "D..."
}
...
IDs/name do not match
Joomla! Version: 4.3.3
PHP Version: 8.1.21
The cause for the mismatched API return can be found here:
api/components/com_content/src/View/Articles/JsonapiView.php
In both cases highlighted $tagsIds
and $tagsNames
do not (necessarily) match (automatically) and should be properly checked/associated with each other or their right order has to be guaranteed.
Perhaps it would be better to either fetch the tag data including the names based on the item ID (see TagsHelper::getTagIds
) or to change the underlying queries, so that both the tags within the items object and the return from getTagIds
have a guaranteed (and stable) order.
At first glance, getTagIds
does not seem to have any order specified in the query - which means, it is not guaranteed.
Again, unfortunately I really know very little about joomla's structure and the effect changes might have, so unfortunately I cannot provide a fix.
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
?
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-08-20 07:23:13 |
Closed_By | ⇒ | alikon |
First of all: Thanks for the quick response!
You added ORDER BY
statements to TagsHelper::getTagNames
but none to TagsHelper::getTagIds
, yet both methods are beeing called in JsonapiView.php. Further: Are you sure the order of the tag IDs derived from the item object are guaranteed/save?
please test #41397