Increased fuse search distance from 100 (default) to 150

This commit is contained in:
Alvaro 2022-08-08 16:41:20 -06:00 committed by GitHub
parent 46428b5af6
commit aa2bb68d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -28,6 +28,9 @@ describe('filterAndSortConversationsByRecent', () => {
e164: '+16505559876',
activeAt: 2,
}),
getDefaultConversation({
title: 'A long title ending with burrito',
}),
];
it('sorts by recency when no search term is provided', () => {
@ -42,6 +45,16 @@ describe('filterAndSortConversationsByRecent', () => {
'Boxing Club',
'Abraham Lincoln',
'Not recent',
'A long title ending with burrito',
]);
});
it('finds a conversation when the search term is at the end of a long title', () => {
const titles = filterAndSortConversationsByRecent(
conversations,
'burrito',
'US'
).map(convo => convo.title);
assert.deepEqual(titles, ['A long title ending with burrito']);
});
});

View File

@ -19,6 +19,9 @@ const FUSE_OPTIONS: Fuse.IFuseOptions<ConversationType> = {
useExtendedSearch: true,
// We sort manually anyway
shouldSort: true,
// the default of 100 is not enough to catch a word at the end of a convo/group title
// 150 is about right
distance: 150,
keys: [
{
name: 'searchableTitle',