diff --git a/src/Orchard.Web/Modules/Orchard.Search/Controllers/ContentPickerController.cs b/src/Orchard.Web/Modules/Orchard.Search/Controllers/ContentPickerController.cs index d7f35f1f7..d456444d7 100644 --- a/src/Orchard.Web/Modules/Orchard.Search/Controllers/ContentPickerController.cs +++ b/src/Orchard.Web/Modules/Orchard.Search/Controllers/ContentPickerController.cs @@ -47,8 +47,6 @@ namespace Orchard.Search.Controllers { public ActionResult Index(PagerParameters pagerParameters, string part, string field, string searchText = "") { var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters); var searchSettingsPart = Services.WorkContext.CurrentSite.As(); - var searchIndex = searchSettingsPart.SearchIndex; - var searchFields = searchSettingsPart.GetSearchFields(searchSettingsPart.SearchIndex); var totalCount = 0; var foundIds = new int[0]; @@ -66,6 +64,11 @@ namespace Orchard.Search.Controllers { return View("NoIndex"); } + var searchIndex = searchSettingsPart.SearchIndex; + if (settings != null && !String.IsNullOrEmpty(settings.SearchIndex)) + searchIndex = settings.SearchIndex; + var searchFields = searchSettingsPart.GetSearchFields(searchIndex); + var builder = _indexManager.GetSearchIndexProvider().CreateSearchBuilder(searchIndex); try { @@ -75,12 +78,12 @@ namespace Orchard.Search.Controllers { var rawTypes = settings.DisplayedContentTypes.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); var contentTypes = _contentDefinitionManager .ListTypeDefinitions() - .Where(x => x.Parts.Any(p => rawTypes.Contains(p.PartDefinition.Name))) + .Where(x => x.Parts.Any(p => rawTypes.Contains(p.PartDefinition.Name)) || rawTypes.Contains(x.Name)) .ToArray(); foreach (string type in contentTypes.Select(x => x.Name)) { - builder.WithField("type", type).AsFilter(); + builder.WithField("type", type).NotAnalyzed().AsFilter(); } } @@ -124,4 +127,4 @@ namespace Orchard.Search.Controllers { return new ShapeResult(this, Services.New.ContentPicker().Tab(tab)); } } -} \ No newline at end of file +} diff --git a/src/Orchard.Web/Modules/Orchard.Search/Controllers/MediaController.cs b/src/Orchard.Web/Modules/Orchard.Search/Controllers/MediaController.cs index 0acb1c2ed..1e43a7701 100644 --- a/src/Orchard.Web/Modules/Orchard.Search/Controllers/MediaController.cs +++ b/src/Orchard.Web/Modules/Orchard.Search/Controllers/MediaController.cs @@ -34,7 +34,7 @@ namespace Orchard.Search.Controllers { } if (!String.IsNullOrEmpty(mediaType)) { - builder.WithField("type", mediaType).Mandatory().AsFilter(); + builder.WithField("type", mediaType).NotAnalyzed().AsFilter(); } if (!String.IsNullOrEmpty(folderPath)) { diff --git a/src/Orchard.Web/Modules/Orchard.Search/Routes.cs b/src/Orchard.Web/Modules/Orchard.Search/Routes.cs index de55ecbb5..afe26e55b 100644 --- a/src/Orchard.Web/Modules/Orchard.Search/Routes.cs +++ b/src/Orchard.Web/Modules/Orchard.Search/Routes.cs @@ -13,6 +13,20 @@ namespace Orchard.Search { public IEnumerable GetRoutes() { return new[] { + new RouteDescriptor { + Priority = 5, + Route = new Route("Search/ContentPicker", + new RouteValueDictionary { + {"area", "Orchard.Search"}, + {"controller", "ContentPicker"}, + {"action", "Index"} + }, + null, + new RouteValueDictionary { + {"area", "Orchard.Search"} + }, + new MvcRouteHandler()) + }, new RouteDescriptor { Priority = 5, Route = new Route("Search/{searchIndex}", @@ -31,4 +45,4 @@ namespace Orchard.Search { }; } } -} \ No newline at end of file +}