private void SavePriority(IndexDefinitionModel indexDefinitionModel) { if (indexDefinitionModel.PriorityChanged == false) { return; } var priority = Abstractions.Data.IndexingPriority.Normal; switch (indexDefinitionModel.IndexingPriority.Value) { case "Normal": priority = Abstractions.Data.IndexingPriority.Normal; break; case "Idle": priority = Abstractions.Data.IndexingPriority.Idle | Abstractions.Data.IndexingPriority.Forced; break; case "Disabled": priority = Abstractions.Data.IndexingPriority.Disabled | Abstractions.Data.IndexingPriority.Forced; break; case "Abandoned": priority = Abstractions.Data.IndexingPriority.Abandoned | Abstractions.Data.IndexingPriority.Forced; break; } var priorityString = priority.ToString().Replace(" ", ""); ApplicationModel.Current.Server.Value.SelectedDatabase.Value .AsyncDatabaseCommands .CreateRequest(string.Format("/indexes/set-priority/{0}?priority={1}", Uri.EscapeUriString(indexDefinitionModel.Name), priorityString), "POST") .ExecuteRequestAsync(); }
public override void LoadModelParameters(string parameters) { var urlParser = new UrlParser(parameters); if (urlParser.GetQueryParam("mode") == "dynamic") { IsDynamicQuery = true; DatabaseCommands.GetTermsAsync("Raven/DocumentsByEntityName", "Tag", "", 100) .ContinueOnSuccess(collections => DynamicOptions.Match(new[] { "AllDocs" }.Concat(collections).ToArray())); return; } IndexName = urlParser.Path.Trim('/'); DatabaseCommands.GetIndexAsync(IndexName) .ContinueOnSuccessInTheUIThread(definition => { if (definition == null) { IndexDefinitionModel.HandleIndexNotFound(IndexName); return; } fields.Match(definition.Fields); IsSpatialQuerySupported = definition.Map.Contains("SpatialIndex.Generate"); SetSortByOptions(fields); Execute.Execute(string.Empty); }).Catch(); }
public override void LoadModelParameters(string parameters) { var urlParser = new UrlParser(parameters); IndexName = urlParser.Path.Trim('/'); DatabaseCommands.GetIndexAsync(IndexName) .ContinueOnSuccessInTheUIThread(definition => { if (definition == null) { IndexDefinitionModel.HandleIndexNotFound(IndexName); return; } }).Catch(); }
public override void LoadModelParameters(string parameters) { var urlParser = new UrlParser(parameters); IndexName = urlParser.Path.Trim('/'); DatabaseCommands.GetIndexAsync(IndexName) .ContinueOnSuccessInTheUIThread(definition => { if (definition == null) { IndexDefinitionModel.HandleIndexNotFound(IndexName); return; } fields.Match(definition.Fields); foreach (var field in fields) { var localterms = fieldsTermsDictionary[field] = new List <string>(); GetTermsForField(field, localterms); } }).Catch(); }
public override void LoadModelParameters(string parameters) { var urlParser = new UrlParser(parameters); ClearCurrentQuery(); if (urlParser.GetQueryParam("mode") == "dynamic") { var collection = urlParser.GetQueryParam("collection"); IsDynamicQuery = true; DatabaseCommands.GetTermsAsync("Raven/DocumentsByEntityName", "Tag", "", 100) .ContinueOnSuccessInTheUIThread(collections => { DynamicOptions.Match(new[] { "AllDocs" }.Concat(collections).ToArray()); string selectedOption = null; if (!string.IsNullOrEmpty(collection)) { selectedOption = DynamicOptions.FirstOrDefault(s => s.Equals(collection)); } if (selectedOption == null) { selectedOption = DynamicOptions[0]; } DynamicSelectedOption = selectedOption; DocumentsResult.SetChangesObservable(null); }); return; } IsDynamicQuery = false; IndexName = urlParser.Path.Trim('/'); DatabaseCommands.GetIndexAsync(IndexName) .ContinueOnUIThread(task => { if (task.IsFaulted || task.Result == null) { IndexDefinitionModel.HandleIndexNotFound(IndexName); return; } var fields = task.Result.Fields; QueryIndexAutoComplete = new QueryIndexAutoComplete(fields, IndexName, QueryDocument); const string spatialindexGenerateLegacy = "SpatialIndex.Generate"; const string spatialindexGenerate = "SpatialGenerate"; IsSpatialQuerySupported = task.Result.Maps.Any(x => x.Contains(spatialindexGenerate) || x.Contains(spatialindexGenerateLegacy)) || (task.Result.Reduce != null && (task.Result.Reduce.Contains(spatialindexGenerate) || task.Result.Reduce.Contains(spatialindexGenerateLegacy))); HasTransform = !string.IsNullOrEmpty(task.Result.TransformResults); DocumentsResult.SetChangesObservable( d => d.IndexChanges .Where(n => n.Name.Equals(indexName, StringComparison.InvariantCulture)) .Select(m => Unit.Default)); SetSortByOptions(fields); RestoreHistory(); }).Catch(); }
public DeleteIndexCommand(IndexDefinitionModel index) { this.index = index; }
public ResetIndexCommand(IndexDefinitionModel index) { this.index = index; }
public RemoveFieldCommand(IndexDefinitionModel index) { this.index = index; }