search ignore accent chars

This commit is contained in:
Luke Pulverenti 2015-01-08 22:34:09 -05:00
parent baf5e0c18b
commit aff870aaaf
2 changed files with 14 additions and 3 deletions

View File

@ -1,4 +1,5 @@
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
@ -114,7 +115,12 @@ namespace MediaBrowser.Server.Implementations.Library
}
// Ignore samples
if (filename.IndexOf(".sample.", StringComparison.OrdinalIgnoreCase) != -1)
var sampleFilename = " " + filename.Replace(".", " ", StringComparison.OrdinalIgnoreCase)
.Replace("-", " ", StringComparison.OrdinalIgnoreCase)
.Replace("_", " ", StringComparison.OrdinalIgnoreCase)
.Replace("!", " ", StringComparison.OrdinalIgnoreCase);
if (sampleFilename.IndexOf(" sample ", StringComparison.OrdinalIgnoreCase) != -1)
{
return true;
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
@ -97,6 +98,8 @@ namespace MediaBrowser.Server.Implementations.Library
throw new ArgumentNullException("searchTerm");
}
searchTerm = searchTerm.RemoveDiacritics();
var terms = GetWords(searchTerm);
var hints = new List<Tuple<BaseItem, string, int>>();
@ -318,6 +321,8 @@ namespace MediaBrowser.Server.Implementations.Library
throw new ArgumentNullException("input");
}
input = input.RemoveDiacritics();
if (string.Equals(input, searchInput, StringComparison.OrdinalIgnoreCase))
{
return new Tuple<string, int>(searchInput, 0);