mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
if the query contains includes:, we want to search in all folders
This commit is contained in:
parent
6d88fed3ce
commit
6e73b10771
1 changed files with 7 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { LiqeQuery, parse } from '@omnivore/liqe'
|
||||
|
||||
export const parseSearchQuery = (query: string): LiqeQuery => {
|
||||
const searchQuery = query
|
||||
let searchQuery = query
|
||||
.replace(/\W\s":/g, '')
|
||||
.replace('in:subscription', 'has:subscriptions') // compatibility with old search
|
||||
.replace('in:library', 'no:subscription') // compatibility with old search
|
||||
|
|
@ -10,9 +10,14 @@ export const parseSearchQuery = (query: string): LiqeQuery => {
|
|||
// remove any quotes that are in the array value for example: label:"test","test2" -> label:"test,test2"
|
||||
.replace(/","/g, ',')
|
||||
|
||||
// if the query contains includes:, we want to search in all folders
|
||||
if (searchQuery.includes('includes:')) {
|
||||
searchQuery = `(${searchQuery}) in:all`
|
||||
}
|
||||
|
||||
// by default we want to search in the inbox if no in: is specified
|
||||
if (!searchQuery.includes('in:')) {
|
||||
return parse(`(${searchQuery}) in:inbox`)
|
||||
searchQuery = `(${searchQuery}) in:inbox`
|
||||
}
|
||||
|
||||
return parse(searchQuery)
|
||||
|
|
|
|||
Loading…
Reference in a new issue