Fix lucene views
This commit is contained in:
parent
7d8238ec98
commit
53620907bb
|
@ -89,7 +89,7 @@ export async function search(
|
||||||
|
|
||||||
if (!isExternalTable && !(await features.flags.isEnabled("SQS"))) {
|
if (!isExternalTable && !(await features.flags.isEnabled("SQS"))) {
|
||||||
// Lucene does not accept conditional filters, so we need to keep the old logic
|
// Lucene does not accept conditional filters, so we need to keep the old logic
|
||||||
const query: SearchFilters = {}
|
const query: SearchFilters = viewQuery
|
||||||
|
|
||||||
// Extract existing fields
|
// Extract existing fields
|
||||||
const existingFields =
|
const existingFields =
|
||||||
|
@ -101,13 +101,12 @@ export async function search(
|
||||||
Object.keys(options.query).forEach(key => {
|
Object.keys(options.query).forEach(key => {
|
||||||
const operator = key as Exclude<SearchFilterKey, LogicalOperator>
|
const operator = key as Exclude<SearchFilterKey, LogicalOperator>
|
||||||
Object.keys(options.query[operator] || {}).forEach(field => {
|
Object.keys(options.query[operator] || {}).forEach(field => {
|
||||||
if (existingFields.includes(db.removeKeyNumbering(field))) {
|
if (!existingFields.includes(db.removeKeyNumbering(field))) {
|
||||||
query[operator]![field] = viewQuery[operator]![field]
|
|
||||||
} else {
|
|
||||||
query[operator]![field] = options.query[operator]![field]
|
query[operator]![field] = options.query[operator]![field]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
options.query = query
|
||||||
} else {
|
} else {
|
||||||
options.query = {
|
options.query = {
|
||||||
$and: {
|
$and: {
|
||||||
|
|
Loading…
Reference in New Issue