async Task BuildIndexKeyword(IList <Post> data) { FSStaticBuilder.EnsureDirectoryEmpty(Paths.GetKeywordRoot(RootPath)); var(collection, map) = await KeywordCollectionBuilder.BuildFromPosts(data.ToAsyncEnumerable()); foreach (var v in collection.Items) { await BuildDataIdList(map[v.OneName()].Select(x => x.Id).ToArray(), Paths.GetKeywordRoot(RootPath, v)).ConfigureAwait(false); } await using var st = FSStaticBuilder.GetFileRewriteStream(Paths.GetKeywordMetadata(RootPath)); await JsonSerializer.SerializeAsync(st, collection).ConfigureAwait(false); }
async Task BuildIndexKeyword() { FsBuilder.EnsureDirectoryEmpty("keywords"); var(collection, map) = KeywordCollectionBuilder.BuildFromPosts(Data); foreach (var v in collection.Items) { string subdir = Path.Join("keywords", NameUtility.Encode(v.OneName())); PagingProvider <string> paging = new PagingProvider <string>(Path.Join(RootPath, subdir)); await paging.Build(map[v.OneName()].Select(x => x.Id).ToArray(), PagingConfig).ConfigureAwait(false); } using var st = FsBuilder.GetFileRewriteStream("keywords/all.json"); await JsonSerializer.SerializeAsync(st, collection).ConfigureAwait(false); }
public async Task <KeywordCollection> GetKeywords(CancellationToken cancellationToken = default) { var cates = DbSet.AsQueryable().Select(x => x.Keywords).Distinct().AsAsyncEnumerable(); return(await KeywordCollectionBuilder.Build(cates.Select(x => Keyword.Parse(x)), cancellationToken)); }