From d7afd7cf9606cd30c1bea35fed431f195c2e0914 Mon Sep 17 00:00:00 2001 From: Mengwei Ding Date: Wed, 13 Feb 2019 13:30:22 +0800 Subject: [PATCH] [Code] boost exact match for symbol qname --- x-pack/plugins/code/server/routes/repository.ts | 3 ++- .../plugins/code/server/search/symbol_search_client.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/code/server/routes/repository.ts b/x-pack/plugins/code/server/routes/repository.ts index 19a7cfd0cadbd..c0b37dc0519c0 100644 --- a/x-pack/plugins/code/server/routes/repository.ts +++ b/x-pack/plugins/code/server/routes/repository.ts @@ -158,7 +158,8 @@ export function repositoryRoute( try { indexStatus = await repoObjectClient.getRepositoryLspIndexStatus(repoUri); } catch (error) { - log.error(`Get repository index status ${repoUri} error: ${error}`); + // index status won't exist if during clone, so suppress the error log to debug level. + log.debug(`Get repository index status ${repoUri} error: ${error}`); } let deleteStatus = null; diff --git a/x-pack/plugins/code/server/search/symbol_search_client.ts b/x-pack/plugins/code/server/search/symbol_search_client.ts index 995e3fe799022..804422240de90 100644 --- a/x-pack/plugins/code/server/search/symbol_search_client.ts +++ b/x-pack/plugins/code/server/search/symbol_search_client.ts @@ -59,6 +59,15 @@ export class SymbolSearchClient extends AbstractSearchClient { }, }, }, + // Boost the exact match for qname. + { + term: { + qname: { + value: req.query, + boost: 10.0, + }, + }, + }, { prefix: { 'symbolInformation.name': { @@ -67,6 +76,7 @@ export class SymbolSearchClient extends AbstractSearchClient { }, }, }, + // Boost the exact match for symbol name. { term: { 'symbolInformation.name': {