mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
fix searching for multiple labels in iOS
This commit is contained in:
parent
7277b27a9f
commit
d42f257f9e
2 changed files with 6 additions and 4 deletions
|
|
@ -181,15 +181,14 @@ export const buildQuery = (
|
|||
return null
|
||||
}
|
||||
|
||||
const param = 'implicit_field'
|
||||
const alias = 'rank'
|
||||
const param = `implicit_field_${parameters.length}`
|
||||
const alias = `rank_${parameters.length}`
|
||||
selects.push({
|
||||
column: `ts_rank_cd(library_item.search_tsv, websearch_to_tsquery('english', :${param}))`,
|
||||
alias,
|
||||
})
|
||||
|
||||
// always sort by rank first
|
||||
orders.unshift({ by: alias, order: SortOrder.DESCENDING })
|
||||
orders.push({ by: alias, order: SortOrder.DESCENDING })
|
||||
|
||||
return escapeQueryWithParameters(
|
||||
`websearch_to_tsquery('english', :${param}) @@ library_item.search_tsv`,
|
||||
|
|
@ -532,6 +531,7 @@ export const buildQuery = (
|
|||
}
|
||||
case 'use':
|
||||
case 'mode':
|
||||
case 'event':
|
||||
// mode is ignored and used only by the frontend
|
||||
return null
|
||||
case 'readPosition':
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ export const parseSearchQuery = (query: string): LiqeQuery => {
|
|||
.replace('in:library', 'no:subscription') // compatibility with old search
|
||||
// wrap the value behind colon in quotes if it's not already
|
||||
.replace(/(\w+):("([^"]+)"|([^")\s]+))/g, '$1:"$3$4"')
|
||||
// remove any quotes that are in the array value for example: label:"test","test2" -> label:"test,test2"
|
||||
.replace(/","/g, ',')
|
||||
|
||||
return parse(searchQuery)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue