Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robert Lundberg 14 posts 60 karma points
    Jan 29, 2015 @ 10:19
    Robert Lundberg
    0

    Category functionallity, performance

    Hi, Okej so I am fairly new to Umbraco, 

    I have implemented some basic category functionallity, the way I have done this is by defining a Multinode Treepicker datatype and adding it to the documenttype that needs to be categorizable.
    In an UmbracoApiController I'm querying for the document type and filtering on selected categories like this:

    private IEnumerable GetAttractions(int[] nodes, IEnumerable<int> categories)
            {
                var attractions =
                    Umbraco.TypedContent(nodes).DescendantsOrSelf<Attraction>()
                        .Where(a => categories.Any(cat => a.MainCategories.Any(acat => acat.Id == cat)));
    
                return attractions;
            }

    Now to my problem/question:
    According to MiniProfiler the above retrieval seems to add a sql query for every found documenttype, so if there is 5 documents then I get at least 5 sql scalar queries.

    I thought that this IPublishedContent approach would only hit the umbraco content cache. I don't have many documents in the Database yet but my fear is that this won't scale very well.

    We expect the amount of filterable IPublishedContent to be about ~500-1000.
    And the requirements are that we can filter on categories, parent node and date span.
    Is there a better/prefered way of doing categories in umbraco?
    Appreciate any tips or thoughts on this.

    Edit:
    Umbraco version 7.2.1

    //
    Regards
    Robert
  • Robert Lundberg 14 posts 60 karma points
    Feb 01, 2015 @ 22:50
    Robert Lundberg
    0

    Ok, so I keept the MNTP for category implementation but went for the examine approach for filtering, I did how ever build the queries manually instead of using the chaining features, as I couldn't really make those work as I wanted.


    Some links I found useful regarding examine/lucene were:
    http://our.umbraco.org/documentation/Reference/Searching/Examine/full-configuration

    http://shazwazza.com/post/searching-multi-node-tree-picker-data-or-any-collection-with-examine/ ;

     http://www.lucenetutorial.com/lucene-query-syntax.html

     //
    Cheers
    Robert 

Please Sign in or register to post replies

Write your reply to:

Draft