1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

lowercase fields

This commit is contained in:
Kyle Spearrin 2018-09-14 09:22:35 -04:00
parent 2fadcb8d04
commit d9808250c6

View File

@ -40,9 +40,9 @@ export class SearchService implements SearchServiceAbstraction {
this.index = null; this.index = null;
const builder = new lunr.Builder(); const builder = new lunr.Builder();
builder.ref('id'); builder.ref('id');
(builder as any).field('shortId', { boost: 100, extractor: (c: CipherView) => c.id.substr(0, 8) }); (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('name', { boost: 10 });
(builder as any).field('subTitle', { (builder as any).field('subtitle', {
boost: 5, boost: 5,
extractor: (c: CipherView) => { extractor: (c: CipherView) => {
if (c.subTitle != null && c.type === CipherType.Card) { if (c.subTitle != null && c.type === CipherType.Card) {
@ -110,7 +110,7 @@ export class SearchService implements SearchServiceAbstraction {
const soWild = lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING; const soWild = lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING;
searchResults = index.query((q) => { searchResults = index.query((q) => {
q.term(query, { fields: ['name'], wildcard: soWild }); q.term(query, { fields: ['name'], wildcard: soWild });
q.term(query, { fields: ['subTitle'], wildcard: soWild }); q.term(query, { fields: ['subtitle'], wildcard: soWild });
q.term(query, { fields: ['login.uris'], wildcard: soWild }); q.term(query, { fields: ['login.uris'], wildcard: soWild });
lunr.tokenizer(query).forEach((token) => { lunr.tokenizer(query).forEach((token) => {
q.term(token.toString(), {}); q.term(token.toString(), {});