increase speed of mysql when searching posts

This commit is contained in:
2024-02-18 18:50:01 +03:00
parent 24977c90bd
commit 2ae2d92e26
5 changed files with 42 additions and 4 deletions
@@ -61,11 +61,15 @@ internal static class RichSiteSummaryRepositoryExtension
await repository.ForFetching(period, 25);
#endregion
#region Post
[Obsolete("Use ByFeedAndUrlHash()")]
public static async Task<Post> ByFeedAndUrl(this DbSet<Post> repository, string url, Feed feed = null) =>
await repository.FirstOrDefaultAsync(post => post.Url == url && (feed == null || post.Feed == feed));
public static async Task<Post> ByFeedAndUrlHash(this DbSet<Post> repository, string urlHash, Feed feed = null) =>
await repository.FirstOrDefaultAsync(post => post.UrlHash == urlHash && (feed == null || post.Feed == feed));
#endregion
}