Skip to content

Commit

Permalink
add slash replacements so that postgres properly splits the terms for…
Browse files Browse the repository at this point in the history
… the search
  • Loading branch information
Masterjun3 committed Jan 28, 2024
1 parent 62edf17 commit 0d4c562
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TASVideos/Pages/Search/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public async Task<IActionResult> OnGet()
.ToListAsync();

GameResults = await _db.Games
.Where(g => EF.Functions.ToTsVector("simple", g.DisplayName + " || " + g.Aliases + " || " + g.Abbreviation).Matches(EF.Functions.WebSearchToTsQuery("simple", SearchTerms)))
.OrderByDescending(g => EF.Functions.ToTsVector("simple", g.DisplayName).ToStripped().Rank(EF.Functions.WebSearchToTsQuery("simple", SearchTerms), NpgsqlTsRankingNormalization.DivideByLength))
.Where(g => EF.Functions.ToTsVector("simple", g.DisplayName.Replace("/", " ") + " || " + g.Aliases + " || " + g.Abbreviation).Matches(EF.Functions.WebSearchToTsQuery("simple", SearchTerms)))
.OrderByDescending(g => EF.Functions.ToTsVector("simple", g.DisplayName.Replace("/", " ")).ToStripped().Rank(EF.Functions.WebSearchToTsQuery("simple", SearchTerms), NpgsqlTsRankingNormalization.DivideByLength))
.ThenBy(g => g.DisplayName.Length)
.ThenBy(g => g.DisplayName)
.Skip(skip)
Expand Down

0 comments on commit 0d4c562

Please sign in to comment.