You are viewing a single comment's thread from:

RE: 0000000000000100 - Steemit Interface PoC - Tag Cloud and Tidy Up

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 😆

Sort:  

And currently, my 1 tag is the community

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 🤔

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.

Coin Marketplace

STEEM 0.26
TRX 0.21
JST 0.038
BTC 96876.93
ETH 3684.06
USDT 1.00
SBD 3.87