-
-
+
+
+
+
Examine Management
+

+
+
+
+
+
+
Indexers
+
+
+
+
+
+
+
+ | Include node types |
+ |
+
+
+ | Exclude node types |
+ |
+
+
+ | Parent node id |
+ |
+
+
+
+
+
System fields
+
+
+
+ | Name |
+ Enable sorting |
+ Type |
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+
+
User fields
+
+
+
+ | Name |
+ Enable sorting |
+ Type |
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/src/Umbraco.Web.UI/umbraco_client/Dashboards/ExamineManagement.css b/src/Umbraco.Web.UI/umbraco_client/Dashboards/ExamineManagement.css
index 5f282702bb..39cf8f3d25 100644
--- a/src/Umbraco.Web.UI/umbraco_client/Dashboards/ExamineManagement.css
+++ b/src/Umbraco.Web.UI/umbraco_client/Dashboards/ExamineManagement.css
@@ -1 +1,23 @@
-
\ No newline at end of file
+#examineManagement .indexer {
+ padding-top: 3px;
+}
+
+#examineManagement .propertyPane {
+ padding: 5px;
+}
+
+#examineManagement table th
+{
+ font-weight: bold;
+ width: 200px;
+}
+#examineManagement table td {
+ color: #999;
+}
+
+#examineManagement .propertyPane strong
+{
+ color: #f26e20;
+ padding: 3px;
+ display: block;
+}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/umbraco_client/Dashboards/ExamineManagement.js b/src/Umbraco.Web.UI/umbraco_client/Dashboards/ExamineManagement.js
index cf44c67b0c..87dcfb9c28 100644
--- a/src/Umbraco.Web.UI/umbraco_client/Dashboards/ExamineManagement.js
+++ b/src/Umbraco.Web.UI/umbraco_client/Dashboards/ExamineManagement.js
@@ -3,11 +3,21 @@
(function ($) {
Umbraco.Dashboards.ExamineManagement = base2.Base.extend({
-
+
//private methods/variables
_opts: null,
_koViewModel: null,
+ _mapDictionaryToArray: function (dictionary) {
+ var result = [];
+ for (var key in dictionary) {
+ if (dictionary.hasOwnProperty(key)) {
+ result.push({ key: key, value: dictionary[key] });
+ }
+ }
+ return result;
+ },
+
// Constructor
constructor: function (opts) {
// Merge options with default
@@ -20,29 +30,53 @@
init: function () {
var self = this;
-
+
//The knockout js view model for the selected item
self._koViewModel = {
- summary: ko.observable(""),
- loading: ko.observable(false)
+ indexerDetails: ko.observable(""),
+ loading: ko.observable(false),
+ expandIndex: function () {
+
+ }
//publishAll: ko.observable(false),
//includeUnpublished: ko.observable(false)
};
-
+
ko.applyBindings(self._koViewModel, self._opts.container.get(0));
- this.loadSummary();
+ this.loadDetails();
},
-
- loadSummary: function() {
+
+ loadDetails: function () {
var self = this;
self._koViewModel.loading(true);
- $.get(self._opts.restServiceLocation + "Index",
- function(e) {
+ $.get(self._opts.restServiceLocation + "GetIndexerDetails",
+ function (e) {
self._koViewModel.loading(false);
- self._koViewModel.summary(e);
- }, "html").fail(function(a, b, c) {
+
+ for (var item in e) {
+ //need to re-map the dictionary to an array so we can bind to it
+ e[item].IndexerProperties = self._mapDictionaryToArray(e[item].IndexerProperties);
+ //add a showProperties property to the object
+ e[item].showProperties = ko.observable(false);
+ //add a toggleProperties method
+ e[item].toggleProperties = function () {
+ this.showProperties(!this.showProperties());
+ };
+ //change the include/exclude node types to say something different if they are empty
+ e[item].IndexCriteria.IncludeNodeTypes = e[item].IndexCriteria.IncludeNodeTypes.join();
+ e[item].IndexCriteria.ExcludeNodeTypes = e[item].IndexCriteria.ExcludeNodeTypes.join();
+ if (e[item].IndexCriteria.IncludeNodeTypes == "")
+ e[item].IndexCriteria.IncludeNodeTypes = "Include all";
+ if (e[item].IndexCriteria.ExcludeNodeTypes == "")
+ e[item].IndexCriteria.ExcludeNodeTypes = "Exclude none";
+ //change the Standard and user fields to be an array so we can bind it
+ //e[item].IndexCriteria.StandardFields = self._mapDictionaryToArray(e[item].IndexerProperties);
+ }
+
+ self._koViewModel.indexerDetails(e);
+ }).fail(function (a, b, c) {
alert("error: " + b);
});
}
diff --git a/src/Umbraco.Web/Search/ExamineDetailsModel.cs b/src/Umbraco.Web/Search/ExamineDetailsModel.cs
index ac72b6a832..0b80bdbe5c 100644
--- a/src/Umbraco.Web/Search/ExamineDetailsModel.cs
+++ b/src/Umbraco.Web/Search/ExamineDetailsModel.cs
@@ -8,17 +8,15 @@ namespace Umbraco.Web.Search
{
public class ExamineIndexerModel
{
- public string Name { get; set; }
- public bool SupportsUnpublished { get; set; }
- public bool SupportsProtected { get; set; }
- public IIndexCriteria IndexCriteria { get; set; }
+ public ExamineIndexerModel()
+ {
+ IndexerProperties = new Dictionary
();
+ }
+
+ public string Name { get; set; }
+ public IIndexCriteria IndexCriteria { get; set; }
+
+ public IDictionary IndexerProperties { get; private set; }
}
- ///
- /// Model to use to render the dashboard details
- ///
- public class ExamineDashboardDetails
- {
- public IEnumerable Indexers { get; set; }
- }
}
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 21e3a4a666..1825c03580 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -548,6 +548,7 @@
ASPXCodeBehind
+
@@ -1757,7 +1758,7 @@
-
+
diff --git a/src/Umbraco.Web/UrlHelperExtensions.cs b/src/Umbraco.Web/UrlHelperExtensions.cs
index 68415c2f03..a60d765f87 100644
--- a/src/Umbraco.Web/UrlHelperExtensions.cs
+++ b/src/Umbraco.Web/UrlHelperExtensions.cs
@@ -4,6 +4,7 @@ using System.Web.Mvc;
using Umbraco.Core;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
+using Umbraco.Web.WebServices;
namespace Umbraco.Web
{
@@ -12,6 +13,17 @@ namespace Umbraco.Web
///
public static class UrlHelperExtensions
{
+ ///
+ /// Returns the base path (not including the 'action') of the MVC controller "ExamineManagementController"
+ ///
+ ///
+ ///
+ public static string GetExamineManagementServicePath(this UrlHelper url)
+ {
+ var result = url.GetUmbracoApiService("GetIndexerDetails");
+ return result.TrimEnd("GetIndexerDetails").EnsureEndsWith('/');
+ }
+
///
/// Return the Url for a Web Api service
///
diff --git a/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs b/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs
new file mode 100644
index 0000000000..5134db9d97
--- /dev/null
+++ b/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Web;
+using System.Web.Http;
+using Umbraco.Core.Configuration;
+using Umbraco.Web.Security;
+using umbraco.BusinessLogic;
+
+namespace Umbraco.Web.WebApi
+{
+ [UmbracoAuthorize]
+ public abstract class UmbracoAuthorizedApiController : UmbracoApiController
+ {
+ private User _user;
+ private bool _userisValidated = false;
+
+ ///
+ /// The current user ID
+ ///
+ private int _uid = 0;
+
+ ///
+ /// The page timeout in seconds.
+ ///
+ private long _timeout = 0;
+
+ ///
+ /// Returns the currently logged in Umbraco User
+ ///
+ protected User UmbracoUser
+ {
+ get
+ {
+ if (!_userisValidated) ValidateUser();
+ return _user;
+ }
+ }
+
+ private void ValidateUser()
+ {
+ if ((WebSecurity.UmbracoUserContextId != ""))
+ {
+ _uid = WebSecurity.GetUserId(WebSecurity.UmbracoUserContextId);
+ _timeout = WebSecurity.GetTimeout(WebSecurity.UmbracoUserContextId);
+
+ if (_timeout > DateTime.Now.Ticks)
+ {
+ _user = global::umbraco.BusinessLogic.User.GetUser(_uid);
+
+ // Check for console access
+ if (_user.Disabled || (_user.NoConsole && GlobalSettings.RequestIsInUmbracoApplication(HttpContext.Current) && !GlobalSettings.RequestIsLiveEditRedirector(HttpContext.Current)))
+ {
+ throw new ArgumentException("You have no priviledges to the umbraco console. Please contact your administrator");
+ }
+ _userisValidated = true;
+ WebSecurity.UpdateLogin(_timeout);
+ }
+ else
+ {
+ throw new ArgumentException("User has timed out!!");
+ }
+ }
+ else
+ {
+ throw new InvalidOperationException("The user has no umbraco contextid - try logging in");
+ }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Web/WebServices/ExamineManagementApiController.cs b/src/Umbraco.Web/WebServices/ExamineManagementApiController.cs
new file mode 100644
index 0000000000..f326076b15
--- /dev/null
+++ b/src/Umbraco.Web/WebServices/ExamineManagementApiController.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web.Mvc;
+using Examine;
+using Examine.LuceneEngine.Providers;
+using Umbraco.Core;
+using Umbraco.Core.Configuration;
+using Umbraco.Web.Mvc;
+using Umbraco.Web.Search;
+using Umbraco.Web.WebApi;
+
+namespace Umbraco.Web.WebServices
+{
+ public class ExamineManagementApiController : UmbracoAuthorizedApiController
+ {
+ ///
+ /// Get the details
+ ///
+ ///
+ public IEnumerable GetIndexerDetails()
+ {
+ var model = new List(
+ ExamineManager.Instance.IndexProviderCollection.Select(indexer =>
+ {
+ var indexerModel = new ExamineIndexerModel()
+ {
+ IndexCriteria = indexer.IndexerData,
+ Name = indexer.Name
+ };
+ var props = TypeHelper.CachedDiscoverableProperties(indexer.GetType(), mustWrite: false)
+ //ignore these properties
+ .Where(x => !new[] { "IndexerData", "Description", "WorkingFolder" }.InvariantContains(x.Name))
+ .OrderBy(x => x.Name);
+ foreach (var p in props)
+ {
+ indexerModel.IndexerProperties.Add(p.Name, p.GetValue(indexer, null).ToString());
+ }
+ return indexerModel;
+ }));
+ return model;
+ }
+
+ //public IEnumerable GetSearcherDetails()
+ //{
+ // var model = new List(
+ // ExamineManager.Instance.IndexProviderCollection.Select(indexer =>
+ // {
+ // var indexerModel = new ExamineIndexerModel()
+ // {
+ // IndexCriteria = indexer.IndexerData,
+ // Name = indexer.Name
+ // };
+ // var props = TypeHelper.CachedDiscoverableProperties(indexer.GetType(), mustWrite: false)
+ // .OrderBy(x => x.Name);
+ // foreach (var p in props)
+ // {
+ // indexerModel.IndexerProperties.Add(p.Name, p.GetValue(indexer, null).ToString());
+ // }
+ // return indexerModel;
+ // }));
+ // return model;
+ //}
+
+
+ }
+}
diff --git a/src/Umbraco.Web/WebServices/ExamineManagementController.cs b/src/Umbraco.Web/WebServices/ExamineManagementController.cs
deleted file mode 100644
index 19e92cffeb..0000000000
--- a/src/Umbraco.Web/WebServices/ExamineManagementController.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Web.Mvc;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-using Umbraco.Web.Mvc;
-
-namespace Umbraco.Web.WebServices
-{
- public class ExamineManagementController : UmbracoAuthorizedController
- {
- ///
- /// Get the details
- ///
- ///
- public ActionResult Index()
- {
- return View("~" + GlobalSettings.Path.EnsureEndsWith('/').EnsureStartsWith('/') + "Views/ExamineManagement/ExamineDetails.cshtml");
- }
-
- }
-}
diff --git a/src/UmbracoExamine/UmbracoContentIndexer.cs b/src/UmbracoExamine/UmbracoContentIndexer.cs
index f29a20f0d3..6be57db384 100644
--- a/src/UmbracoExamine/UmbracoContentIndexer.cs
+++ b/src/UmbracoExamine/UmbracoContentIndexer.cs
@@ -341,7 +341,7 @@ namespace UmbracoExamine
{
if (CanInitialize())
{
- return indexSet.ToIndexCriteria(DataService);
+ return indexSet.ToIndexCriteria(DataService, IndexFieldPolicies);
}
else
{