architecture-center icon indicating copy to clipboard operation
architecture-center copied to clipboard

Cross correlated blog post Id starts from 2

Open cassiot opened this issue 2 years ago • 1 comments

The Use tags to cross-correlate cached items section has a code example that starts the blogKey = 1, but there is a blogKey++ before it is cached for the first time, making it start from 2.

Later there are examples that use the key "blog:posts:1:tags", the will never exist.

List<string[]> tags = new List<string[]>
{
    new[] { "iot","csharp" },
    new[] { "iot","azure","csharp" },
    new[] { "csharp","git","big data" },
    new[] { "iot","git","database" },
    new[] { "database","git" },
    new[] { "csharp","database" },
    new[] { "iot" },
    new[] { "iot","database","git" },
    new[] { "azure","database","big data","git","csharp" },
    new[] { "azure" }
};

List<BlogPost> posts = new List<BlogPost>();
int blogKey = 1;
int numberOfPosts = 20;
Random random = new Random();
for (int i = 0; i < numberOfPosts; i++)
{
    blogKey++;
    posts.Add(new BlogPost(
        blogKey,                  // Blog post ID
        string.Format(CultureInfo.InvariantCulture, "Blog Post #{0}",
            blogKey),             // Blog post title
        random.Next(100, 10000),  // Ranking score
        tags[i % tags.Count]));   // Tags--assigned from a collection
                                  // in the tags list
}

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

cassiot avatar Aug 01 '22 12:08 cassiot

@cassiot Thanks for the feedback! I have assigned the issue to the content author to investigate further and update the document as appropriate.

MayankBargali-MSFT avatar Aug 01 '22 12:08 MayankBargali-MSFT

#please-close

v-fearam avatar Mar 13 '23 17:03 v-fearam