fix eslint errors for search packages (#11868)
This commit is contained in:
Родитель
cb9c277821
Коммит
3b1a3fc99a
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import {
|
||||
IndexDocumentsAction,
|
||||
SearchIndexingBufferedSenderUploadDocumentsOptions,
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import { SearchClient } from "./searchClient";
|
||||
import { IndexDocumentsBatch } from "./indexDocumentsBatch";
|
||||
import {
|
||||
|
@ -244,7 +247,9 @@ class SearchIndexingBufferedSenderImpl<T> implements SearchIndexingBufferedSende
|
|||
if (this.batchObject.actions.length > 0) {
|
||||
await this.internalFlush(true);
|
||||
}
|
||||
this.cleanupTimer && this.cleanupTimer();
|
||||
if (this.cleanupTimer) {
|
||||
this.cleanupTimer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -283,7 +283,7 @@ export function convertSimilarityToPublic(
|
|||
return similarity;
|
||||
}
|
||||
|
||||
if (similarity.odatatype == "#Microsoft.Azure.Search.ClassicSimilarity") {
|
||||
if (similarity.odatatype === "#Microsoft.Azure.Search.ClassicSimilarity") {
|
||||
return similarity as ClassicSimilarity;
|
||||
} else {
|
||||
return similarity as BM25Similarity;
|
||||
|
@ -370,7 +370,9 @@ export function generatedIndexToPublicIndex(generatedIndex: GeneratedSearchIndex
|
|||
};
|
||||
}
|
||||
|
||||
export function generatedSearchResultToPublicSearchResult<T>(results: GeneratedSearchResult[]) {
|
||||
export function generatedSearchResultToPublicSearchResult<T>(
|
||||
results: GeneratedSearchResult[]
|
||||
): SearchResult<T>[] {
|
||||
const returnValues: SearchResult<T>[] = results.map<SearchResult<T>>((result) => {
|
||||
const { _score, _highlights, ...restProps } = result;
|
||||
const doc: { [key: string]: any } = {
|
||||
|
|
|
@ -62,7 +62,7 @@ describe("SearchClient", function() {
|
|||
|
||||
it("autocomplete returns zero results for invalid query", async function() {
|
||||
const autoCompleteResult: AutocompleteResult = await searchClient.autocomplete("garbxyz", "sg");
|
||||
assert.isTrue(autoCompleteResult.results.length == 0);
|
||||
assert.isTrue(autoCompleteResult.results.length === 0);
|
||||
});
|
||||
|
||||
it("search returns the correct search result", async function() {
|
||||
|
|
|
@ -99,8 +99,6 @@ describe("SearchIndexClient", function() {
|
|||
];
|
||||
assert.include(synonyms, synonymMap.synonyms[0]);
|
||||
assert.include(synonyms, synonymMap.synonyms[1]);
|
||||
} catch (ex) {
|
||||
throw ex;
|
||||
} finally {
|
||||
await indexClient.deleteSynonymMap(synonymMap);
|
||||
}
|
||||
|
@ -207,8 +205,6 @@ describe("SearchIndexClient", function() {
|
|||
index = await indexClient.getIndex(indexName);
|
||||
assert.equal(index.name, indexName);
|
||||
assert.equal(index.fields.length, 5);
|
||||
} catch (ex) {
|
||||
throw ex;
|
||||
} finally {
|
||||
await indexClient.deleteIndex(index);
|
||||
}
|
||||
|
|
|
@ -109,8 +109,6 @@ describe("SearchIndexerClient", function() {
|
|||
assert.equal(indexer.dataSourceName, "my-data-source-1");
|
||||
assert.equal(indexer.targetIndexName, TEST_INDEX_NAME);
|
||||
assert.isFalse(indexer.isDisabled);
|
||||
} catch (ex) {
|
||||
throw ex;
|
||||
} finally {
|
||||
await indexerClient.deleteIndexer(indexer);
|
||||
}
|
||||
|
@ -178,8 +176,6 @@ describe("SearchIndexerClient", function() {
|
|||
assert.equal(dataSourceConnection.name, "my-data-source-3");
|
||||
assert.equal(dataSourceConnection.type, "cosmosdb");
|
||||
assert.equal(dataSourceConnection.container.name, "hotels");
|
||||
} catch (ex) {
|
||||
throw ex;
|
||||
} finally {
|
||||
await indexerClient.deleteDataSourceConnection(dataSourceConnection);
|
||||
}
|
||||
|
@ -267,8 +263,6 @@ describe("SearchIndexerClient", function() {
|
|||
assert.equal(skillSet.skills.length, 1);
|
||||
assert.equal(skillSet.skills[0].inputs.length, 2);
|
||||
assert.equal(skillSet.skills[0].outputs.length, 3);
|
||||
} catch (ex) {
|
||||
throw ex;
|
||||
} finally {
|
||||
await indexerClient.deleteSkillset(skillSet);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче