Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBERF-4428: Add option to disable indexing for a class #4090

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions models/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,5 @@ export class TConfiguration extends TDoc implements Configuration {
@MMixin(core.mixin.IndexConfiguration, core.class.Class)
export class TIndexConfiguration<T extends Doc = Doc> extends TClass implements IndexingConfiguration<T> {
indexes!: FieldIndex<T>[]
searchDisabled!: boolean
}
1 change: 1 addition & 0 deletions packages/core/src/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,4 +498,5 @@ export type FieldIndex<T extends Doc> = {
export interface IndexingConfiguration<T extends Doc> extends Class<Doc> {
// Define a list of extra index definitions.
indexes: (FieldIndex<T> | string)[]
searchDisabled?: boolean
}
4 changes: 2 additions & 2 deletions server/core/src/indexer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ export const contentStageId = 'cnt-v2b'
/**
* @public
*/
export const fieldStateId = 'fld-v8'
export const fieldStateId = 'fld-v9'

/**
* @public
*/
export const fullTextPushStageId = 'fts-v5'
export const fullTextPushStageId = 'fts-v6'
7 changes: 7 additions & 0 deletions server/core/src/indexer/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ export function isClassIndexable (hierarchy: Hierarchy, c: Ref<Class<Doc>>): boo
hierarchy.setClassifierProp(c, 'class_indexed', false)
return false
}

const indexMixin = hierarchy.classHierarchyMixin(c, core.mixin.IndexConfiguration)
if (indexMixin?.searchDisabled !== undefined && indexMixin?.searchDisabled) {
hierarchy.setClassifierProp(c, 'class_indexed', false)
return false
}

const attrs = getFullTextIndexableAttributes(hierarchy, c)
for (const d of hierarchy.getDescendants(c)) {
if (hierarchy.isMixin(d)) {
Expand Down