Issues with Listing by Tag / uBlogsy 3 MVC on Umbraco 6.1.1.
Hi,
First off, thanks for that nice piece of code, really useful.
I have a slight issue...in fact 2...
The first one was easily overcome: When using "PostService.Instance.GetPosts" to retrieve my blog posts, even if i pass 10 as "itemsPerPage", the first 2 pages contains 9 items, then the following ones 10, until the last one. I have 62 items (made sure of that querying manually the db) but postCount reports 64.... (i have no Unpublished articles). To fix it, i reverted to using NoLuceneFallbackService.Instance.GetPosts which render the pages & amount of items correctly.
The second one is that while NoLuceneFallbackService.Instance.GetPosts fixed my listing problem, it broke the listing by Tag (listing by Author still works). The page still renders, but no blog posts are returned. This feature worked using PostService.Instance.GetPosts.
------------------ const int ITEMS_PER_PAGE = 10; // for testing
//for testing purpose i removed the skip, just to see how many item renders var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).Take(ITEMS_PER_PAGE).ToIPublishedContent(true);
//simple foreach to get every node in posts var gcounter = 1; foreach(var post in posts){ <p>@gcounter - @post.Name</p> gcounter++; }
---------------
It outputs 1 to 9, not 10...
postCount returns 64 (should return 62)...
When i call PostService.Instance.GetPosts removing the "Take(var)" to return everything... posts.Count() = 62 and postCount still = 64
I was having an issue with the number of posts showing up per page (on the blog landing). I was suppose to have 6 posts per page, but some of the pages had different amounts. I fixed this by changing:
var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).Skip((page - 1) * itemsPerPage).Take(itemsPerPage).ToIPublishedContent(true);
to
var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).ToIPublishedContent(true).Skip((page - 1) * itemsPerPage).Take(itemsPerPage);
Not the best fix, as I assume there will be a slight performance issue.
I assume the reason for mine is I somehow had some null nodes, not sure how, but the ToIPublishedContent with option true, ignores null nodes. And I need to ignore the null nodes before selecting the Take(items)
Issues with Listing by Tag / uBlogsy 3 MVC on Umbraco 6.1.1.
Hi,
First off, thanks for that nice piece of code, really useful.
I have a slight issue...in fact 2...
The first one was easily overcome: When using "PostService.Instance.GetPosts" to retrieve my blog posts, even if i pass 10 as "itemsPerPage", the first 2 pages contains 9 items, then the following ones 10, until the last one. I have 62 items (made sure of that querying manually the db) but postCount reports 64.... (i have no Unpublished articles).
To fix it, i reverted to using NoLuceneFallbackService.Instance.GetPosts which render the pages & amount of items correctly.
The second one is that while NoLuceneFallbackService.Instance.GetPosts fixed my listing problem, it broke the listing by Tag (listing by Author still works). The page still renders, but no blog posts are returned. This feature worked using PostService.Instance.GetPosts.
Any clue on what to do to fix this ?
------------------
const int ITEMS_PER_PAGE = 10; // for testing
//for testing purpose i removed the skip, just to see how many item renders
var posts = PostService.Instance.GetPosts(Model.Content, tag, label, author, searchTerm, commenter, year, month, day, out postCount).Take(ITEMS_PER_PAGE).ToIPublishedContent(true);
//simple foreach to get every node in posts
var gcounter = 1;
foreach(var post in posts){
<p>@gcounter - @post.Name</p>
gcounter++;
}
---------------
It outputs 1 to 9, not 10...
postCount returns 64 (should return 62)...
When i call PostService.Instance.GetPosts removing the "Take(var)" to return everything... posts.Count() = 62 and postCount still = 64
Nevermind, i deleted all Lucene indexes files, and "save & publish" each blog post and it fixed the issue. Quite tedious, but at least, now it works
I think you could have also done a save & publish by right-clicking the root node.
I was having an issue with the number of posts showing up per page (on the blog landing). I was suppose to have 6 posts per page, but some of the pages had different amounts. I fixed this by changing:
to
Not the best fix, as I assume there will be a slight performance issue.
I assume the reason for mine is I somehow had some null nodes, not sure how, but the ToIPublishedContent with option true, ignores null nodes. And I need to ignore the null nodes before selecting the Take(items)
is working on a reply...