From f4870c4678112638b693e59872ae936dc2989ae7 Mon Sep 17 00:00:00 2001 From: Shikhir Arora Date: Thu, 2 Mar 2017 11:22:07 -0500 Subject: [PATCH] Update QuoteRepository.cs --- .../Services/Database/Repositories/Impl/QuoteRepository.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/NadekoBot/Services/Database/Repositories/Impl/QuoteRepository.cs b/src/NadekoBot/Services/Database/Repositories/Impl/QuoteRepository.cs index be9db36d..a7036dff 100644 --- a/src/NadekoBot/Services/Database/Repositories/Impl/QuoteRepository.cs +++ b/src/NadekoBot/Services/Database/Repositories/Impl/QuoteRepository.cs @@ -1,4 +1,5 @@ -using NadekoBot.Services.Database.Models; +using NadekoBot.Services.Database.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -26,9 +27,7 @@ namespace NadekoBot.Services.Database.Repositories.Impl public Task SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text) { var rngk = new NadekoRandom(); - string lowertext = text.ToLowerInvariant(); - string uppertext = text.ToUpperInvariant(); - return _set.Where(q => (q.Text.Contains(text) | q.Text.Contains(lowertext) | q.Text.Contains(uppertext)) & (q.GuildId == guildId && q.Keyword == keyword)).OrderBy(q => rngk.Next()).FirstOrDefaultAsync(); + return _set.Where(q => q.Text.IndexOf(text, StringComparison.OrdinalIgnoreCase) >=0 && q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rngk.Next()).FirstOrDefaultAsync(); } } }