Skip to content

Commit

Permalink
Fix: filter not preferring full matches in back +
Browse files Browse the repository at this point in the history
  The fuzzy filter wasn't scoring full matches
  high enough, when they weren't at the
  beginning of the name.

  Given the filter 'ger', results have been:

    - (Ger)hard Burg
    - (Ge)of(r)ey
    - Armin (Ger)lach

  with this fix the are:

    - (Ger)hard Burg
    - Armin (Ger)lach
    - (Ge)of(r)ey
  • Loading branch information
rbeer committed Apr 1, 2020
1 parent a6484e3 commit b05cc30
Show file tree
Hide file tree
Showing 4 changed files with 593 additions and 8 deletions.
57 changes: 54 additions & 3 deletions webapp/components/features/FollowList/FollowList.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { action } from '@storybook/addon-actions'
import helpers from '~/storybook/helpers'
import FollowList from './FollowList.vue'

import fuzzyFilterUser from './FollowList.story.json'

helpers.init()

const user = {
Expand All @@ -30,6 +32,12 @@ const noConnectionsUser = {
followingCount: 0,
}

const wrapTemplates = (templates) => `
<div style="display: flex; flex-wrap: wrap;">
${templates.map((template) => `<div style="margin: 8px;">${template}</div>`).join('')}
</div>
`

storiesOf('FollowList', module)
.addDecorator(withA11y)
.addDecorator(helpers.layout)
Expand All @@ -40,7 +48,10 @@ storiesOf('FollowList', module)
data() {
return { user: noConnectionsUser }
},
template: `<div><follow-list :user="user" /><div style="margin: 1rem"></div><follow-list :user="user" type="followedBy" /></div>`,
template: wrapTemplates([
'<follow-list :user="user" />',
'<follow-list :user="user" type="followedBy" />',
]),
}
})
.add('with up to 7 connections', () => {
Expand All @@ -56,7 +67,10 @@ storiesOf('FollowList', module)
action('fetchAllConnections')(type, this.user)
},
},
template: `<div style="display: flex; flex-wrap: wrap;"><div style="margin: 8px;"><follow-list :user="user" @fetchAllConnections="fetchAllConnections"/></div><div style="margin: 8px;"><follow-list :user="user" type="followedBy" @fetchAllConnections="fetchAllConnections"/></div></div>`,
template: wrapTemplates([
'<follow-list :user="user" @fetchAllConnections="fetchAllConnections"/>',
'<follow-list :user="user" type="followedBy" @fetchAllConnections="fetchAllConnections"/>',
]),
}
})

Expand All @@ -67,6 +81,43 @@ storiesOf('FollowList', module)
data() {
return { user: allConnectionsUser }
},
template: `<div style="display: flex; flex-wrap: wrap;"><div style="margin: 8px;"><follow-list :user="user" /></div><div style="margin: 8px;"><follow-list :user="user" type="followedBy"/></div></div>`,
template: wrapTemplates([
'<follow-list :user="user" />',
'<follow-list :user="user" type="followedBy"/>',
]),
}
})
.add('with a lot of connections', () => {
return {
components: { FollowList },
store: helpers.store,
data() {
return {
user: {
...user,
followedByCount: 1000,
followingCount: 1000,
followedBy: helpers.fakeUser(1000),
following: helpers.fakeUser(1000),
},
}
},
template: wrapTemplates([
'<follow-list :user="user" />',
'<follow-list :user="user" type="followedBy"/>',
]),
}
})
.add('Fuzzy Filter', () => {
return {
components: { FollowList },
store: helpers.store,
data() {
return { user: fuzzyFilterUser }
},
template: wrapTemplates([
'<follow-list :user="user" />',
'<follow-list :user="user" type="followedBy">',
]),
}
})
Loading

0 comments on commit b05cc30

Please sign in to comment.