fixes #1571 - Search containing umlauts fails

This commit is contained in:
Luke Pulverenti 2016-04-30 15:47:47 -04:00
parent a15a762ba1
commit d75cc21d37

View File

@ -18,6 +18,7 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Model.LiveTv;
@ -80,7 +81,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
private IDbCommand _updateInheritedRatingCommand;
private IDbCommand _updateInheritedTagsCommand;
private const int LatestSchemaVersion = 64;
private const int LatestSchemaVersion = 65;
/// <summary>
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
@ -226,6 +227,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.AddColumn(Logger, "TypedBaseItems", "CriticRatingSummary", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "DateModifiedDuringLastRefresh", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "InheritedTags", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "CleanName", "Text");
PrepareStatements();
@ -466,7 +468,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
"CriticRating",
"CriticRatingSummary",
"DateModifiedDuringLastRefresh",
"InheritedTags"
"InheritedTags",
"CleanName"
};
_saveItemCommand = _connection.CreateCommand();
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
@ -792,6 +795,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveItemCommand.GetParameter(index++).Value = null;
}
if (string.IsNullOrWhiteSpace(item.Name))
{
_saveItemCommand.GetParameter(index++).Value = null;
}
else
{
_saveItemCommand.GetParameter(index++).Value = item.Name.RemoveDiacritics();
}
_saveItemCommand.Transaction = transaction;
_saveItemCommand.ExecuteNonQuery();
@ -1986,7 +1998,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
if (!string.IsNullOrWhiteSpace(query.NameContains))
{
whereClauses.Add("Name like @NameContains");
whereClauses.Add("CleanName like @NameContains");
cmd.Parameters.Add(cmd, "@NameContains", DbType.String).Value = "%" + query.NameContains + "%";
}