mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 17:23:37 +00:00
Update lunr type (#93)
This commit is contained in:
@@ -41,9 +41,9 @@ export class SearchService implements SearchServiceAbstraction {
|
||||
this.index = null;
|
||||
const builder = new lunr.Builder();
|
||||
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', {
|
||||
builder.field('shortid', { boost: 100, extractor: (c: CipherView) => c.id.substr(0, 8) });
|
||||
builder.field('name', { boost: 10 });
|
||||
builder.field('subtitle', {
|
||||
boost: 5,
|
||||
extractor: (c: CipherView) => {
|
||||
if (c.subTitle != null && c.type === CipherType.Card) {
|
||||
@@ -53,16 +53,16 @@ export class SearchService implements SearchServiceAbstraction {
|
||||
},
|
||||
});
|
||||
builder.field('notes');
|
||||
(builder as any).field('login.username', {
|
||||
builder.field('login.username', {
|
||||
extractor: (c: CipherView) => c.type === CipherType.Login && c.login != null ? c.login.username : null,
|
||||
});
|
||||
(builder as any).field('login.uris', { boost: 2, extractor: (c: CipherView) => this.uriExtractor(c) });
|
||||
(builder as any).field('fields', { extractor: (c: CipherView) => this.fieldExtractor(c, false) });
|
||||
(builder as any).field('fields_joined', { extractor: (c: CipherView) => this.fieldExtractor(c, true) });
|
||||
(builder as any).field('attachments', { extractor: (c: CipherView) => this.attachmentExtractor(c, false) });
|
||||
(builder as any).field('attachments_joined',
|
||||
builder.field('login.uris', { boost: 2, extractor: (c: CipherView) => this.uriExtractor(c) });
|
||||
builder.field('fields', { extractor: (c: CipherView) => this.fieldExtractor(c, false) });
|
||||
builder.field('fields_joined', { extractor: (c: CipherView) => this.fieldExtractor(c, true) });
|
||||
builder.field('attachments', { extractor: (c: CipherView) => this.attachmentExtractor(c, false) });
|
||||
builder.field('attachments_joined',
|
||||
{ extractor: (c: CipherView) => this.attachmentExtractor(c, true) });
|
||||
(builder as any).field('organizationid', { extractor: (c: CipherView) => c.organizationId });
|
||||
builder.field('organizationid', { extractor: (c: CipherView) => c.organizationId });
|
||||
const ciphers = await this.cipherService.getAllDecrypted();
|
||||
ciphers.forEach((c) => builder.add(c));
|
||||
this.index = builder.build();
|
||||
|
||||
Reference in New Issue
Block a user