mirror of
https://github.com/bitwarden/browser.git
synced 2025-04-12 19:46:17 +02:00
Update lunr type (#93)
This commit is contained in:
parent
e9db844285
commit
8438cafbd0
6
package-lock.json
generated
6
package-lock.json
generated
@ -304,9 +304,9 @@
|
||||
}
|
||||
},
|
||||
"@types/lunr": {
|
||||
"version": "2.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.1.6.tgz",
|
||||
"integrity": "sha512-Bz6fUhX1llTa7ygQJN3ttoVkkrpW7xxSEP7D7OYFO/FCBKqKqruRUZtJzTtYA0GkQX13lxU5u+8LuCviJlAXkQ==",
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.3.3.tgz",
|
||||
"integrity": "sha512-09sXZZVsB3Ib41U0fC+O1O+4UOZT1bl/e+/QubPxpqDWHNEchvx/DEb1KJMOwq6K3MTNzZFoNSzVdR++o1DVnw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
|
@ -29,7 +29,7 @@
|
||||
"@types/inquirer": "^0.0.43",
|
||||
"@types/jasmine": "^3.3.12",
|
||||
"@types/lowdb": "^1.0.5",
|
||||
"@types/lunr": "^2.1.6",
|
||||
"@types/lunr": "^2.3.3",
|
||||
"@types/node": "^10.9.4",
|
||||
"@types/node-fetch": "^2.1.2",
|
||||
"@types/node-forge": "^0.7.5",
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user