Allow filtering by author

This commit is contained in:
Jackson Harper
2022-11-11 15:01:14 +08:00
parent f9fa4656d0
commit 83dbb54896
2 changed files with 10 additions and 0 deletions

View File

@ -280,6 +280,7 @@ export const parseSearchQuery = (query: string | undefined): SearchFilter => {
'sort',
'has',
'saved',
'author',
'published',
'subscription',
'language',
@ -355,6 +356,7 @@ export const parseSearchQuery = (query: string | undefined): SearchFilter => {
break
}
// match filters
case 'author':
case 'title':
case 'description':
case 'content': {

View File

@ -151,3 +151,11 @@ describe('query with in param set to invalid value', () => {
expect(result.inFilter).to.eq(InFilter.INBOX)
})
})
describe('query with author set', () => {
it('adds author to the match filters', () => {
const result = parseSearchQuery('author:"Omnivore Blog"')
expect(result.matchFilters).to.contain({ field: 'author', value:'omnivore blog' })
})
})