wip
This commit is contained in:
parent
95f5844a44
commit
7e4f571eb3
|
@ -94,7 +94,18 @@ describe.each([
|
|||
|
||||
private async performSearch(): Promise<Row[]> {
|
||||
if (isInMemory) {
|
||||
return dataFilters.runQuery(rows, this.query.query)
|
||||
let result = dataFilters.runQuery(rows, this.query.query)
|
||||
if (this.query.sort) {
|
||||
result = dataFilters.sort(
|
||||
result,
|
||||
this.query.sort,
|
||||
this.query.sortOrder || SortOrder.ASCENDING
|
||||
)
|
||||
}
|
||||
if (this.query.limit) {
|
||||
result = dataFilters.limit(result, this.query.limit.toString())
|
||||
}
|
||||
return result
|
||||
} else {
|
||||
return (
|
||||
await config.api.row.search(table._id!, {
|
||||
|
|
|
@ -7,9 +7,9 @@ import {
|
|||
SearchFilters,
|
||||
SearchQueryFields,
|
||||
SearchFilterOperator,
|
||||
SortDirection,
|
||||
SortType,
|
||||
FieldConstraints,
|
||||
SortOrder,
|
||||
} from "@budibase/types"
|
||||
import dayjs from "dayjs"
|
||||
import { OperatorOptions, SqlNumberTypeRangeMap } from "./constants"
|
||||
|
@ -454,7 +454,7 @@ export const runQuery = (docs: any[], query?: SearchFilters) => {
|
|||
export const sort = (
|
||||
docs: any[],
|
||||
sort: string,
|
||||
sortOrder: SortDirection,
|
||||
sortOrder: SortOrder,
|
||||
sortType = SortType.STRING
|
||||
) => {
|
||||
if (!sort || !sortOrder || !sortType) {
|
||||
|
|
Loading…
Reference in New Issue