From cf795bc39c729844c8c0900a3ec0befc95348de3 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 12 Sep 2018 10:22:46 -0400 Subject: [PATCH] dont index asterisk on card last4 --- src/services/search.service.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/services/search.service.ts b/src/services/search.service.ts index 606375ce58..94518ca739 100644 --- a/src/services/search.service.ts +++ b/src/services/search.service.ts @@ -6,6 +6,7 @@ import { CipherService } from '../abstractions/cipher.service'; import { PlatformUtilsService } from '../abstractions/platformUtils.service'; import { SearchService as SearchServiceAbstraction } from '../abstractions/search.service'; +import { CipherType } from '../enums/cipherType'; import { DeviceType } from '../enums/deviceType'; import { FieldType } from '../enums/fieldType'; import { UriMatchType } from '../enums/uriMatchType'; @@ -41,7 +42,15 @@ export class SearchService implements SearchServiceAbstraction { builder.ref('id'); (builder as any).field('shortId', { boost: 100, extractor: (c: CipherView) => c.id.substr(0, 8) }); (builder as any).field('name', { boost: 10 }); - (builder as any).field('subTitle', { boost: 5 }); + (builder as any).field('subTitle', { + boost: 5, + extractor: (c: CipherView) => { + if (c.type === CipherType.Card && c.subTitle.indexOf('*') === 0) { + return c.subTitle.substr(1); + } + return c.subTitle; + }, + }); builder.field('notes'); (builder as any).field('login.username', { extractor: (c: CipherView) => c.login != null ? c.login.username : null,