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:
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?
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.
Category functionallity, performance
Hi, Okej so I am fairly new to Umbraco,
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:
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.
//
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
is working on a reply...