You are viewing a single comment's thread from:
RE: 0000000000000100 - Steemit Interface PoC - Tag Cloud and Tidy Up
Adding another layer of complexity, I could allow for multiple tag selection so that people interested in "football" for example, can then filter their posts even more. I don't know how far down this road I'll go just yet but it's a possibility.
That would be a very nice possibility. :-)
But I also think it would be complex because the current API methods only allow filtering by "one" tag. For another tag, you would have to filter the results "manually"....
But I'm sure you'll find a solution... :-)
And currently, my 1 tag is the community 🙂 I'll have to think about it more but it could be that when I'm looping through and reading the tags, I create an array per tag that's been selected and compare the arrays. In fact, it'll be easier than that - I already loop through the tags for each post to get my tag cloud - I just need 2 variables which when I find each tag, toggles the variable to true. If both are true, it stores the post in my "display array".
This probably makes zero sense but it does to me 😆
That's the point!
Your description is similar to what I had in mind at the time: forming intersections. But the theoretically infinite number of tags prevented me from thinking further.
That also makes no sense ;-))
Limiting the data/posts will be essential here....
I've put a limit on - I think it's 5,000 posts per page load which isn't too painful but easily adjusted.
The way I'm doing it is to retrieve the posts from the first tag (I can retrieve 1,000 posts very quickly) and loop through, checking if it matches the 2nd tag - I then store the posts that match in an array to get loaded into the page later. My check for the 2nd tag could just as easily be for the 3rd or 4th tag too. At the end of the loop, I check to see if I've got enough posts to populate my page (which I've currently limited to 25 posts) and if I have, I break the loop. If I reach the end of the 1,000 and don't have enough, I'll call the API again and load in the next 1,000 posts. I've currently got a limit on it being 5 loops.
This doesn't sound too graceful but the point at which I make this asynchronous, it'll improve the experience and would allow me to reduce the loop size or similar.
It doesn't feel great when I write it like I have done so perhaps an API that accepts multiple tags is needed here 🤔
Absolutely right!
An important point is the data structure for filtering the posts. So that standard methods allow filtering with low costs. Then you don't need (multiple) loops.