Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix eslint errors for search packages #11868

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {
IndexDocumentsAction,
SearchIndexingBufferedSenderUploadDocumentsOptions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { SearchClient } from "./searchClient";
import { IndexDocumentsBatch } from "./indexDocumentsBatch";
import {
Expand Down Expand Up @@ -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();
}
}

/**
Expand Down
6 changes: 4 additions & 2 deletions sdk/search/search-documents/src/serviceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 } = {
Expand Down
2 changes: 1 addition & 1 deletion sdk/search/search-documents/test/node/searchClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down