Browse Source

update search

Luke Pulverenti 9 năm trước cách đây
mục cha
commit
4e90d73203

+ 13 - 10
MediaBrowser.Controller/Entities/Folder.cs

@@ -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);
-
-            //var children = ItemRepository.GetChildren(Id).Select(RetrieveChild).Where(i => i != null).ToList();
-
-            //if (children.Count != childrenItems.Count)
-            //{
-            //    var b = this;
-            //}
+            if (ConfigurationManager.Configuration.DisableStartupScan)
+            {
+                return ItemRepository.GetChildrenItems(Id).Select(RetrieveChild).Where(i => i != null);
+                //return ItemRepository.GetItems(new InternalItemsQuery
+                //{
+                //    ParentId = Id
 
-            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;

+ 2 - 0
MediaBrowser.Controller/Entities/InternalItemsQuery.cs

@@ -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[] { };

+ 4 - 0
MediaBrowser.Server.Implementations/Library/LibraryManager.cs

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

+ 6 - 0
MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs

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

+ 6 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

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