update search results

This commit is contained in:
Luke Pulverenti
2016-02-14 12:58:31 -05:00
parent 88debcd967
commit 1d6f82e2ef
5 changed files with 31 additions and 8 deletions

View File

@@ -1914,18 +1914,34 @@ namespace MediaBrowser.Server.Implementations.Persistence
whereClauses.Add("LocationType not in (" + val + ")");
}
var enableItemsByName = query.IncludeItemsByName ?? query.IncludeItemTypes.Length > 0;
if (query.TopParentIds.Length == 1)
{
whereClauses.Add("(TopParentId=@TopParentId or IsItemByName=@IsItemByName)");
if (enableItemsByName)
{
whereClauses.Add("(TopParentId=@TopParentId or IsItemByName=@IsItemByName)");
cmd.Parameters.Add(cmd, "@IsItemByName", DbType.Boolean).Value = true;
}
else
{
whereClauses.Add("(TopParentId=@TopParentId)");
}
cmd.Parameters.Add(cmd, "@TopParentId", DbType.String).Value = query.TopParentIds[0];
cmd.Parameters.Add(cmd, "@IsItemByName", DbType.Boolean).Value = true;
}
if (query.TopParentIds.Length > 1)
{
var val = string.Join(",", query.TopParentIds.Select(i => "'" + i + "'").ToArray());
whereClauses.Add("(IsItemByName=@IsItemByName or TopParentId in (" + val + "))");
cmd.Parameters.Add(cmd, "@IsItemByName", DbType.Boolean).Value = true;
if (enableItemsByName)
{
whereClauses.Add("(IsItemByName=@IsItemByName or TopParentId in (" + val + "))");
cmd.Parameters.Add(cmd, "@IsItemByName", DbType.Boolean).Value = true;
}
else
{
whereClauses.Add("(TopParentId in (" + val + "))");
}
}
if (query.AncestorIds.Length == 1)