This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Dohh - category searches
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
I just made an update to the category search function. I implemented a cache that sped things up, but there was no proper date sorting. Why was that? Well, this is one of those times when my implementation "leaked". Here's what I did:
Each posting has a category
I created a cache dictionary, where the keys are the categories, and the values are a collection of files that have (one or more) postings of that category in them (there's one file per day in this implementation)
The collection was a Set, to prevent the same file from showing up twice in a particular category list
Using a Set, and then not dealing with that was the problem. When posts are placed on the screen, I just iterate over all the posts asked for and render them. That's fine when they are already in reverse chronological order - but a Set is unordered. I hadn't considered that, which is why - until five minutes ago - category searches were bringing back posts in a random order. It's fixed now :)