search ignore accent chars

pull/702/head
Luke Pulverenti 10 years ago
parent baf5e0c18b
commit aff870aaaf

@ -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;
}

@ -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);

Loading…
Cancel
Save