adding support for index aliases
This commit is contained in:
Родитель
c485542d50
Коммит
72cc4691a0
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
26
package.json
26
package.json
|
@ -44,11 +44,13 @@
|
|||
"onCommand:azureCognitiveSearch.createIndexer",
|
||||
"onCommand:azureCognitiveSearch.createSkillset",
|
||||
"onCommand:azureCognitiveSearch.createSynonymMap",
|
||||
"onCommand:azureCognitiveSearch.createAlias",
|
||||
"onCommand:azureCognitiveSearch.deleteDocument",
|
||||
"onCommand:azureCognitiveSearch.deleteDataSource",
|
||||
"onCommand:azureCognitiveSearch.deleteIndexer",
|
||||
"onCommand:azureCognitiveSearch.deleteSkillset",
|
||||
"onCommand:azureCognitiveSearch.deleteSynonymMap",
|
||||
"onCommand:azureCognitiveSearch.deleteAlias",
|
||||
"onCommand:azureCognitiveSearch.search",
|
||||
"onCommand:azureCognitiveSearch.searchDoc",
|
||||
"onCommand:azureCognitiveSearch.resetIndexer",
|
||||
|
@ -212,6 +214,16 @@
|
|||
"title": "Delete synonym map",
|
||||
"category": "Azure Cognitive Search"
|
||||
},
|
||||
{
|
||||
"command": "azureCognitiveSearch.createAlias",
|
||||
"title": "Create new alias",
|
||||
"category": "Azure Cognitive Search"
|
||||
},
|
||||
{
|
||||
"command": "azureCognitiveSearch.deleteAlias",
|
||||
"title": "Delete alias",
|
||||
"category": "Azure Cognitive Search"
|
||||
},
|
||||
{
|
||||
"command": "azureCognitiveSearch.searchDoc",
|
||||
"title": "Search",
|
||||
|
@ -376,6 +388,16 @@
|
|||
"command": "azureCognitiveSearch.deleteSynonymMap",
|
||||
"when": "view == azureCognitiveSearch && viewItem == azureCognitiveSearchSynonymMap",
|
||||
"group": "navigation@98"
|
||||
},
|
||||
{
|
||||
"command": "azureCognitiveSearch.createAlias",
|
||||
"when": "view == azureCognitiveSearch && viewItem == azureCognitiveSearchAliasList",
|
||||
"group": "navigation@98"
|
||||
},
|
||||
{
|
||||
"command": "azureCognitiveSearch.deleteAlias",
|
||||
"when": "view == azureCognitiveSearch && viewItem == azureCognitiveSearchAlias",
|
||||
"group": "navigation@98"
|
||||
}
|
||||
],
|
||||
"commandPalette": [
|
||||
|
@ -431,6 +453,10 @@
|
|||
{
|
||||
"fileMatch": "*.azsskset",
|
||||
"url": "./schema/skillset.json"
|
||||
},
|
||||
{
|
||||
"fileMatch": "*.azsalias",
|
||||
"url": "./schema/alias.json"
|
||||
}
|
||||
],
|
||||
"languages": [
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<style type="text/css"><![CDATA[
|
||||
.light-base{fill: #ffffff;}
|
||||
]]></style>
|
||||
<path class="light-base" d="M7,10V9H8.1l1-.5a2.314,2.314,0,0,0,.7-.7A4.313,4.313,0,0,0,10,6.5a3.6,3.6,0,0,0-.2-1,3.51,3.51,0,0,0-.5-.8l-.8-.5L7.5,4h-4l-1,.2-.8.5a3.51,3.51,0,0,0-.5.8,3.6,3.6,0,0,0-.2,1,4.3,4.3,0,0,0,.2,1.2l.7.7,1,.5H4V10H3.5a3.5,3.5,0,0,1-1.4-.3A4.079,4.079,0,0,1,1,9,4.079,4.079,0,0,1,.3,7.9a3.417,3.417,0,0,1,0-2.8A4.079,4.079,0,0,1,1,4a4.079,4.079,0,0,1,1.1-.7A3.5,3.5,0,0,1,3.5,3h4a3.5,3.5,0,0,1,1.4.3A4.079,4.079,0,0,1,10,4a4.079,4.079,0,0,1,.7,1.1,3.417,3.417,0,0,1,0,2.8A4.079,4.079,0,0,1,10,9a4.079,4.079,0,0,1-1.1.7,3.5,3.5,0,0,1-1.4.3Zm5-4V7h1.1l1,.5a2.314,2.314,0,0,1,.7.7A4.313,4.313,0,0,1,15,9.5a3.6,3.6,0,0,1-.2,1,3.51,3.51,0,0,1-.5.8l-.8.5-1,.2h-4l-1-.2-.8-.5a3.51,3.51,0,0,1-.5-.8,3.6,3.6,0,0,1-.2-1,4.3,4.3,0,0,1,.2-1.2,2.314,2.314,0,0,1,.7-.7l1-.5H9V6H8.5a3.5,3.5,0,0,0-1.4.3A4.079,4.079,0,0,0,6,7a4.079,4.079,0,0,0-.7,1.1,3.4,3.4,0,0,0,0,2.8A4.079,4.079,0,0,0,6,12a4.079,4.079,0,0,0,1.1.7,3.5,3.5,0,0,0,1.4.3h4a3.5,3.5,0,0,0,1.4-.3A4.079,4.079,0,0,0,15,12a4.079,4.079,0,0,0,.7-1.1,3.4,3.4,0,0,0,0-2.8A4.079,4.079,0,0,0,15,7a4.079,4.079,0,0,0-1.1-.7A3.5,3.5,0,0,0,12.5,6Z" />
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 1.2 KiB |
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path d="M7,10V9H8.1l1-.5a2.314,2.314,0,0,0,.7-.7A4.313,4.313,0,0,0,10,6.5a3.6,3.6,0,0,0-.2-1,3.51,3.51,0,0,0-.5-.8l-.8-.5L7.5,4h-4l-1,.2-.8.5a3.51,3.51,0,0,0-.5.8,3.6,3.6,0,0,0-.2,1,4.3,4.3,0,0,0,.2,1.2l.7.7,1,.5H4V10H3.5a3.5,3.5,0,0,1-1.4-.3A4.079,4.079,0,0,1,1,9,4.079,4.079,0,0,1,.3,7.9a3.417,3.417,0,0,1,0-2.8A4.079,4.079,0,0,1,1,4a4.079,4.079,0,0,1,1.1-.7A3.5,3.5,0,0,1,3.5,3h4a3.5,3.5,0,0,1,1.4.3A4.079,4.079,0,0,1,10,4a4.079,4.079,0,0,1,.7,1.1,3.417,3.417,0,0,1,0,2.8A4.079,4.079,0,0,1,10,9a4.079,4.079,0,0,1-1.1.7,3.5,3.5,0,0,1-1.4.3Zm5-4V7h1.1l1,.5a2.314,2.314,0,0,1,.7.7A4.313,4.313,0,0,1,15,9.5a3.6,3.6,0,0,1-.2,1,3.51,3.51,0,0,1-.5.8l-.8.5-1,.2h-4l-1-.2-.8-.5a3.51,3.51,0,0,1-.5-.8,3.6,3.6,0,0,1-.2-1,4.3,4.3,0,0,1,.2-1.2,2.314,2.314,0,0,1,.7-.7l1-.5H9V6H8.5a3.5,3.5,0,0,0-1.4.3A4.079,4.079,0,0,0,6,7a4.079,4.079,0,0,0-.7,1.1,3.4,3.4,0,0,0,0,2.8A4.079,4.079,0,0,0,6,12a4.079,4.079,0,0,0,1.1.7,3.5,3.5,0,0,0,1.4.3h4a3.5,3.5,0,0,0,1.4-.3A4.079,4.079,0,0,0,15,12a4.079,4.079,0,0,0,.7-1.1,3.4,3.4,0,0,0,0-2.8A4.079,4.079,0,0,0,15,7a4.079,4.079,0,0,0-1.1-.7A3.5,3.5,0,0,0,12.5,6Z" />
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 1.2 KiB |
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Azure Search Alias",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"externalDocs": {
|
||||
"url": "https://docs.microsoft.com/rest/api/searchservice/Naming-rules"
|
||||
},
|
||||
"type": "string",
|
||||
"description": "The name of the alias."
|
||||
},
|
||||
"indexes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "The name of the index this alias maps to. Only one index name may be specified."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"indexes"
|
||||
],
|
||||
"description": "Represents an index alias, which describes a mapping from the alias name to an index. The alias name can be used in place of the index name for supported operations."
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { SearchServiceTreeItem } from "./SearchServiceTreeItem";
|
||||
import { SimpleSearchClient } from "./SimpleSearchClient";
|
||||
import { SearchResourceListTreeItem } from "./SearchResourceListTreeItem";
|
||||
import { getResourcesPath } from "./constants";
|
||||
import { Uri } from "vscode";
|
||||
import * as path from 'path';
|
||||
|
||||
export class AliasListTreeItem extends SearchResourceListTreeItem {
|
||||
public static readonly contextValue: string = "azureCognitiveSearchAliasList";
|
||||
public static readonly itemContextValue: string = "azureCognitiveSearchAlias";
|
||||
|
||||
public constructor(parent: SearchServiceTreeItem, searchClient: SimpleSearchClient) {
|
||||
super(parent,
|
||||
AliasListTreeItem.contextValue,
|
||||
AliasListTreeItem.itemContextValue,
|
||||
"Aliases",
|
||||
SimpleSearchClient.Aliases,
|
||||
"alias",
|
||||
"azsalias",
|
||||
searchClient);
|
||||
}
|
||||
|
||||
public iconPath: { light: string | Uri; dark: string | Uri } = {
|
||||
light: path.join(getResourcesPath(), 'light', 'link.svg'),
|
||||
dark: path.join(getResourcesPath(), 'dark', 'link.svg')
|
||||
};
|
||||
|
||||
}
|
|
@ -145,6 +145,14 @@ export class DocumentEditor implements vscode.Disposable {
|
|||
}
|
||||
]
|
||||
};
|
||||
case 'alias':
|
||||
return {
|
||||
"name": "alias1",
|
||||
"indexes": [
|
||||
"index1"
|
||||
]
|
||||
}
|
||||
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -56,6 +56,12 @@ export class EditableResourceTreeItem extends AzureTreeItem implements IDocument
|
|||
dark: path.join(getResourcesPath(), 'dark', 'info.svg')
|
||||
};
|
||||
}
|
||||
else if (itemKind === "alias") {
|
||||
this.iconPath = {
|
||||
light: path.join(getResourcesPath(), 'light', 'link.svg'),
|
||||
dark: path.join(getResourcesPath(), 'dark', 'link.svg')
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public deleteTreeItemImpl?(_context: IActionContext): Promise<void> {
|
||||
|
|
|
@ -12,6 +12,7 @@ import { SimpleSearchClient } from "./SimpleSearchClient";
|
|||
import { DataSourceListTreeItem } from "./DataSourceListTreeItem";
|
||||
import { IndexerListTreeItem } from "./IndexerListTreeItem";
|
||||
import { SynonymMapListTreeItem } from "./SynonymMapListTreeItem";
|
||||
import { AliasListTreeItem } from "./AliasListTreeItem";
|
||||
import { SkillsetListTreeItem } from "./SkillsetListTreeItem";
|
||||
import { ServiceDetailsTreeItem } from "./ServiceDetailsTreeItem";
|
||||
import { getResourcesPath } from "./constants";
|
||||
|
@ -52,7 +53,8 @@ export class SearchServiceTreeItem extends AzureParentTreeItem {
|
|||
new DataSourceListTreeItem(this, searchClient),
|
||||
new IndexerListTreeItem(this, searchClient),
|
||||
new SkillsetListTreeItem(this, searchClient),
|
||||
new SynonymMapListTreeItem(this, searchClient)
|
||||
new SynonymMapListTreeItem(this, searchClient),
|
||||
new AliasListTreeItem(this, searchClient)
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -72,6 +74,7 @@ export class SearchServiceTreeItem extends AzureParentTreeItem {
|
|||
case IndexerListTreeItem.contextValue: return 4;
|
||||
case SkillsetListTreeItem.contextValue: return 5;
|
||||
case SynonymMapListTreeItem.contextValue: return 6;
|
||||
case AliasListTreeItem.contextValue: return 7;
|
||||
}
|
||||
|
||||
return 100;
|
||||
|
|
|
@ -15,6 +15,7 @@ export class SimpleSearchClient {
|
|||
public static readonly Skillsets: string = "skillsets";
|
||||
public static readonly SynonymMaps: string = "synonymmaps";
|
||||
public static readonly Indexes: string = "indexes";
|
||||
public static readonly Aliases: string = "aliases";
|
||||
|
||||
public constructor(
|
||||
public readonly serviceName: string,
|
||||
|
|
|
@ -26,6 +26,7 @@ import { IndexerListTreeItem } from './IndexerListTreeItem';
|
|||
import { IndexListTreeItem } from './IndexListTreeItem';
|
||||
import { SkillsetListTreeItem } from './SkillsetListTreeItem';
|
||||
import { SynonymMapListTreeItem } from './SynonymMapListTreeItem';
|
||||
import { AliasListTreeItem } from './AliasListTreeItem';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
import { tree } from 'gulp';
|
||||
import * as crypto from "crypto";
|
||||
|
@ -93,6 +94,9 @@ export async function activateInternal(context: vscode.ExtensionContext, perfSta
|
|||
registerCommand("azureCognitiveSearch.deleteSkillset", async (actionContext: IActionContext, treeItem: EditableResourceTreeItem) => deleteResource(treeItem, actionContext, SkillsetListTreeItem.itemContextValue));
|
||||
registerCommand("azureCognitiveSearch.createSynonymMap", async (actionContext: IActionContext, treeItem: SynonymMapListTreeItem) => createResource(treeItem, actionContext, SynonymMapListTreeItem.contextValue));
|
||||
registerCommand("azureCognitiveSearch.deleteSynonymMap", async (actionContext: IActionContext, treeItem: EditableResourceTreeItem) => deleteResource(treeItem, actionContext, SynonymMapListTreeItem.itemContextValue));
|
||||
registerCommand("azureCognitiveSearch.createAlias", async (actionContext: IActionContext, treeItem: AliasListTreeItem) => createResource(treeItem, actionContext, AliasListTreeItem.contextValue));
|
||||
registerCommand("azureCognitiveSearch.deleteAlias", async (actionContext: IActionContext, treeItem: EditableResourceTreeItem) => deleteResource(treeItem, actionContext, AliasListTreeItem.itemContextValue));
|
||||
|
||||
registerCommand("azureCognitiveSearch.search", async (actionContext: IActionContext, treeItem: AzExtTreeItem) => search(treeItem, actionContext, searchResultDocumentProvider));
|
||||
registerCommand("azureCognitiveSearch.openSearchEditor", async (actionContext: IActionContext, treeItem: IndexTreeItem) => openSearchEditor(treeItem));
|
||||
registerCommand("azureCognitiveSearch.openInPortal", async (actionContext: IActionContext, treeItem?: AzureTreeItem) => {
|
||||
|
@ -251,7 +255,7 @@ async function openSearchEditor(treeItem: IndexTreeItem): Promise<void> {
|
|||
const localPath = path.join(os.tmpdir(), "vscode-azs-editor", filename);
|
||||
await fse.ensureFile(localPath);
|
||||
|
||||
var template = "// Press ctrl+alt+r or cmd+alt+r to search";
|
||||
var template = "// Press ctrl+alt+r or cmd+option+r to search";
|
||||
template += "\n\n";
|
||||
template += "// You can send queries in the GET format\n";
|
||||
template += "search=*";
|
||||
|
|
Загрузка…
Ссылка в новой задаче