This project is read-only.


Taxonomy 1.8.1 Release has Small Bug (Fix Included)


With the recent taxonomy changes for 1.8.1 there is a small bug in Orchard.Taxonomies.Handlers.TermsPartHandler --> InitializerTermsLoader method. In the part._termParts.Loader expression it puts the results in a dictionary. However, the Id's are not always distinct (or I have some corrupt data). Either way, here is the fix:

var ids = part.Terms.Select(t => t.TermRecord.Id);
var terms = _contentManager.GetMany<TermPart>(ids, VersionOptions.Published, queryHint)
    .ToDictionary(t => t.Id, t => t);
var ids = part.Terms.Select(t => t.TermRecord.Id).Distinct(); // EMS CHANGE - added .Distinct()
var terms = _contentManager.GetMany<TermPart>(ids, VersionOptions.Published, queryHint)
    .ToDictionary(t => t.Id, t => t);
This ensures that the ids used to get TermPart are unique (and thus the .ToDictionary expression will have unique Id's also).


StanleyGoldman wrote Jul 8, 2014 at 5:04 PM

Glad to know I wasn't the only one...

jchenga wrote Dec 16, 2014 at 5:35 AM

Please disregard the previous pull request.

Here is the correct PR:

jchenga wrote Jan 3, 2015 at 7:46 PM

Sorry about another PR. My fork was corrupted and all the PRs were gone.

Here is the correct and hopefully last PR on this issue:

sebastienros wrote Jan 31, 2015 at 6:59 PM

Fixed in changeset 453389d4c92f512da8751530d24e97f0b0312b91