More in this section
Forums / Bugs & Issues / Issue with TaxonomyManager in Sitefinity 10

Issue with TaxonomyManager in Sitefinity 10

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
4 posts, 1 answered
  1. Chaitanya
    Chaitanya avatar
    22 posts
    Registered:
    14 Oct 2013
    23 Aug 2017
    Link to this post

    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

  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    23 Aug 2017 in reply to Chaitanya
    Link to this post
    What about .ToList before the OrderBy to force the query to memory instead of sql?
  3. Chaitanya
    Chaitanya avatar
    22 posts
    Registered:
    14 Oct 2013
    24 Aug 2017 in reply to Steve
    Link to this post
    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.
  4. Chaitanya
    Chaitanya avatar
    22 posts
    Registered:
    14 Oct 2013
    11 Sep 2017
    Link to this post

    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();
    Answered
4 posts, 1 answered