Issue with TaxonomyManager in Sitefinity 10 - Bugs & Issues - Bugs & Issues - Progress Community

Issue with TaxonomyManager in Sitefinity 10

 Bugs & Issues

Issue with TaxonomyManager in Sitefinity 10

  • Issue with TaxonomyManager in Sitefinity 10
  • Hello,

    We recently upgraded our Sitefinity version from 8 to 10. In a scenario we are fetching hierarchical taxonomies as below

    var someTaxa= manager.GetTaxa<HierarchicalTaxon>().Where(t => t.Taxonomy.Name == "some-name");
     
    return manager.GetTaxa<HierarchicalTaxon>()
                    .Where(t => (t.Parent != null && t.Parent.Name == "X" && t.Taxonomy.Name == "some-other-name")
                    && (!someTaxa.Any(pw => pw.Name == t.Name))) //Filter out Taxanomies that have no "some-name".
                    .OrderBy(t => t.Ordinal).ToList();

     

    This was working fine in Sitefinity 8, after upgrade it threw an error of type "Telerik.OpenAccess.Exceptions.DataStoreException"  with message "Error executing query: Telerik.OpenAccess.RT.sql.SQLException: The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified."

    Is there any change in implementation of taxonomy manager and how to write query for the given scenario

  • What about .ToList before the OrderBy to force the query to memory instead of sql?
  • Tried that. "OrderBy(t => t.Ordinal)" is not causing any issues, it's "order by title" added by taxonomy manager for the first query(order by in sub query).  However if I use ToList() on first query as well as manager.GetTaxa<HierarchicalTaxon>().ToList() on second query, it works. But I do not want to fetch all the hierarchical taxonomy before filtration.
  • Simplified the query as below, so it wont have sub query.

     

    var someTaxa= manager.GetTaxa<HierarchicalTaxon>().Where(t => t.Taxonomy.Name == "some-name").ToList();
     var someOtherTaxa= manager.GetTaxa<HierarchicalTaxon>().Where(t => t.Parent != null && t.Parent.Name == "X" && t.Taxonomy.Name == "some-other-name").ToList();
     return someOtherTaxa.Where(t => !someTaxa.Any(s => s.Name == t.Name)).OrderBy(t => t.Ordinal).ToList();