public ActionResult Index() { var viewModel = new AdminIndexViewModel(); viewModel.Indexes = _luceneIndexManager.List().Select(s => new IndexViewModel { Name = s }).ToArray(); return(View(viewModel)); }
public override async Task PublishedAsync(PublishContentContext context) { // TODO: ignore if this index is not configured for the content type var buildIndexContext = new BuildIndexContext(new DocumentIndex(context.ContentItem.ContentItemId), context.ContentItem, new string[] { context.ContentItem.ContentType }); // Lazy resolution to prevent cyclic dependency var contentItemIndexHandlers = _serviceProvider.GetServices <IContentItemIndexHandler>(); await contentItemIndexHandlers.InvokeAsync(x => x.BuildIndexAsync(buildIndexContext), _logger); foreach (var index in _luceneIndexManager.List()) { _luceneIndexManager.DeleteDocuments(index, new string[] { context.ContentItem.ContentItemId }); _luceneIndexManager.StoreDocuments(index, new DocumentIndex[] { buildIndexContext.DocumentIndex }); } }
public override IDisplayResult Edit(ContentPartFieldDefinition partFieldDefinition) { return(Initialize <ContentPickerFieldLuceneEditorSettings>("ContentPickerFieldLuceneEditorSettings_Edit", model => { partFieldDefinition.PopulateSettings <ContentPickerFieldLuceneEditorSettings>(model); model.Indices = _luceneIndexManager.List().ToArray(); }).Location("Editor")); }
public override IDisplayResult Edit(LuceneSettings section, BuildEditorContext context) { return(Shape <LuceneSettingsViewModel>("LuceneSettings_Edit", model => { model.SearchIndex = section.SearchIndex; model.SearchFields = String.Join(", ", section.DefaultSearchFields ?? new string[0]); model.SearchIndexes = _luceneIndexProvider.List(); }).Location("Content:2").OnGroup("search")); }
public override IDisplayResult Edit(LuceneIndexDeploymentStep step) { return(Initialize <LuceneIndexDeploymentStepViewModel>("LuceneIndexDeploymentStep_Fields_Edit", model => { model.IncludeAll = step.IncludeAll; model.IndexNames = step.IndexNames; model.AllIndexNames = _luceneIndexManager.List().ToArray(); }).Location("Content")); }
public override IDisplayResult Edit(LuceneQuery query, IUpdateModel updater) { return(Shape <LuceneQueryViewModel>("LuceneQuery_Edit", model => { model.Query = query.Template; model.Index = query.Index; model.ReturnContentItems = query.ReturnContentItems; model.Indices = _luceneIndexManager.List().ToArray(); }).Location("Content:5")); }
public override IDisplayResult Edit(LuceneQuery query, IUpdateModel updater) { return(Shape <LuceneQueryViewModel>("LuceneQuery_Edit", model => { model.Query = query.Template; model.Index = query.Index; model.ReturnContentItems = query.ReturnContentItems; model.Indices = _luceneIndexManager.List().ToArray(); // Extract query from the query string if we come from the main query editor if (string.IsNullOrEmpty(query.Template)) { updater.TryUpdateModelAsync(model, "", m => m.Query); } }).Location("Content:5")); }
public override async Task <IDisplayResult> EditAsync(AdminSearchSettings section, BuildEditorContext context) { var user = _httpContextAccessor.HttpContext?.User; if (!await _authorizationService.AuthorizeAsync(user, Permissions.ManageAdminSearchSettings)) { return(null); } return(Initialize <AdminSearchSettingsViewModel>("AdminSearchSettings_Edit", model => { model.AdminSearchIndex = section.AdminSearchIndex; model.AdminSearchFields = String.Join(", ", section.AdminSearchFields ?? new string[0]); model.SearchIndexes = _luceneIndexProvider.List(); }).Location("Content:2").OnGroup(GroupId)); }
public Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlanResult result) { var luceneIndexStep = step as LuceneIndexDeploymentStep; if (luceneIndexStep == null) { return(Task.CompletedTask); } var indices = luceneIndexStep.IncludeAll ? _luceneIndexManager.List().ToArray() : luceneIndexStep.IndexNames; // Adding Lucene settings result.Steps.Add(new JObject( new JProperty("name", "lucene-index"), new JProperty("Indices", JArray.FromObject(indices)) )); return(Task.CompletedTask); }