update search

This commit is contained in:
Luke Pulverenti 2015-09-23 22:31:40 -04:00
parent e429b42146
commit 4e90d73203
5 changed files with 31 additions and 10 deletions

View File

@ -763,21 +763,24 @@ namespace MediaBrowser.Controller.Entities
/// <returns>IEnumerable{BaseItem}.</returns>
protected IEnumerable<BaseItem> GetCachedChildren()
{
var childrenItems = ItemRepository.GetChildrenItems(Id).Select(RetrieveChild).Where(i => i != null);
if (ConfigurationManager.Configuration.DisableStartupScan)
{
return ItemRepository.GetChildrenItems(Id).Select(RetrieveChild).Where(i => i != null);
//return ItemRepository.GetItems(new InternalItemsQuery
//{
// ParentId = Id
//var children = ItemRepository.GetChildren(Id).Select(RetrieveChild).Where(i => i != null).ToList();
//if (children.Count != childrenItems.Count)
//{
// var b = this;
//}
return childrenItems;
//}).Items.Select(RetrieveChild).Where(i => i != null);
}
else
{
return ItemRepository.GetChildrenItems(Id).Select(RetrieveChild).Where(i => i != null);
}
}
private BaseItem RetrieveChild(BaseItem child)
{
if (child.Id == Guid.Empty)
if (child == null || child.Id == Guid.Empty)
{
Logger.Error("Item found with empty Id: " + (child.Path ?? child.Name));
return null;

View File

@ -101,6 +101,8 @@ namespace MediaBrowser.Controller.Entities
public bool? IsOffline { get; set; }
public LocationType? LocationType { get; set; }
public Guid? ParentId { get; set; }
public InternalItemsQuery()
{
Tags = new string[] { };

View File

@ -354,6 +354,10 @@ namespace MediaBrowser.Server.Implementations.Library
return;
}
}
//if (!(item is Folder))
//{
// return;
//}
LibraryItemsCache.AddOrUpdate(id, item, delegate { return item; });
}

View File

@ -1202,6 +1202,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
whereClauses.Add(string.Format("ChannelId in ({0})", inClause));
}
if (query.ParentId.HasValue)
{
whereClauses.Add("ParentId=@ParentId");
cmd.Parameters.Add(cmd, "@ParentId", DbType.Guid).Value = query.ParentId.Value;
}
if (query.MinEndDate.HasValue)
{
whereClauses.Add("EndDate>=@MinEndDate");

View File

@ -309,6 +309,9 @@
<Content Include="dashboard-ui\scripts\searchmenu.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\searchpage.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\secondaryitems.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -330,6 +333,9 @@
<Content Include="dashboard-ui\scripts\wizardlivetvtuner.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\search.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\secondaryitems.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>