Moving search index to an enum.
This commit is contained in:
parent
42fc004212
commit
f070be5f65
|
@ -24,11 +24,6 @@ export enum ViewName {
|
|||
APP_BACKUP_BY_TRIGGER = "by_trigger",
|
||||
}
|
||||
|
||||
export const SearchIndexes = {
|
||||
ROWS: "rows",
|
||||
AUDIT: "audit",
|
||||
}
|
||||
|
||||
export const DeprecatedViews = {
|
||||
[ViewName.USER_BY_EMAIL]: [
|
||||
// removed due to inaccuracy in view doc filter logic
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
import { db as dbCore, context, SearchParams } from "@budibase/backend-core"
|
||||
import { SearchFilters, Row } from "@budibase/types"
|
||||
import { SearchFilters, Row, SearchIndex } from "@budibase/types"
|
||||
|
||||
export async function paginatedSearch(
|
||||
query: SearchFilters,
|
||||
params: SearchParams<Row>
|
||||
) {
|
||||
const appId = context.getAppId()
|
||||
return dbCore.paginatedSearch(
|
||||
appId!,
|
||||
dbCore.SearchIndexes.ROWS,
|
||||
query,
|
||||
params
|
||||
)
|
||||
return dbCore.paginatedSearch(appId!, SearchIndex.ROWS, query, params)
|
||||
}
|
||||
|
||||
export async function fullSearch(
|
||||
|
@ -19,5 +14,5 @@ export async function fullSearch(
|
|||
params: SearchParams<Row>
|
||||
) {
|
||||
const appId = context.getAppId()
|
||||
return dbCore.fullSearch(appId!, dbCore.SearchIndexes.ROWS, query, params)
|
||||
return dbCore.fullSearch(appId!, SearchIndex.ROWS, query, params)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { context, db as dbCore } from "@budibase/backend-core"
|
||||
import { context } from "@budibase/backend-core"
|
||||
import { DocumentType, SEPARATOR, ViewName } from "../utils"
|
||||
import { LinkDocument, Row } from "@budibase/types"
|
||||
import { LinkDocument, Row, SearchIndex } from "@budibase/types"
|
||||
const SCREEN_PREFIX = DocumentType.SCREEN + SEPARATOR
|
||||
|
||||
/**************************************************
|
||||
|
@ -91,7 +91,7 @@ async function searchIndex(indexName: string, fnString: string) {
|
|||
|
||||
export async function createAllSearchIndex() {
|
||||
await searchIndex(
|
||||
dbCore.SearchIndexes.ROWS,
|
||||
SearchIndex.ROWS,
|
||||
function (doc: Row) {
|
||||
function idx(input: Row, prev?: string) {
|
||||
for (let key of Object.keys(input)) {
|
||||
|
|
|
@ -2,6 +2,11 @@ import Nano from "@budibase/nano"
|
|||
import { AllDocsResponse, AnyDocument, Document } from "../"
|
||||
import { Writable } from "stream"
|
||||
|
||||
export enum SearchIndex {
|
||||
ROWS = "rows",
|
||||
AUDIT = "audit",
|
||||
}
|
||||
|
||||
export type PouchOptions = {
|
||||
inMemory?: boolean
|
||||
replication?: boolean
|
||||
|
|
Loading…
Reference in New Issue