Skip to content

Commit

Permalink
[Enterprise Search] Move schema types to shared (#84822)
Browse files Browse the repository at this point in the history
* Move schema types to shared

We use the Schema types in Workplace Search as well, so moving these to shared. Also, we have a component called IndexingStatus so reverting to the prefixed IIndexingStatus interface name

* Fix misspelled interface
  • Loading branch information
scottybollinger authored Dec 2, 2020
1 parent b593781 commit 4f3d72b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { kea, MakeLogicType } from 'kea';

import { HttpLogic } from '../../../shared/http';

import { IndexingStatus } from '../schema/types';
import { IIndexingStatus } from '../../../shared/types';
import { EngineDetails } from './types';

interface EngineValues {
Expand All @@ -25,7 +25,7 @@ interface EngineValues {
interface EngineActions {
setEngineData(engine: EngineDetails): { engine: EngineDetails };
setEngineName(engineName: string): { engineName: string };
setIndexingStatus(activeReindexJob: IndexingStatus): { activeReindexJob: IndexingStatus };
setIndexingStatus(activeReindexJob: IIndexingStatus): { activeReindexJob: IIndexingStatus };
setEngineNotFound(notFound: boolean): { notFound: boolean };
clearEngine(): void;
initializeEngine(): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { ApiToken } from '../credentials/types';
import { Schema, SchemaConflicts, IndexingStatus } from '../schema/types';
import { Schema, SchemaConflicts, IIndexingStatus } from '../../../shared/types';

export interface Engine {
name: string;
Expand All @@ -26,7 +26,7 @@ export interface EngineDetails extends Engine {
schema: Schema;
schemaConflicts?: SchemaConflicts;
unconfirmedFields?: string[];
activeReindexJob?: IndexingStatus;
activeReindexJob?: IIndexingStatus;
invalidBoosts: boolean;
sample?: boolean;
isMeta: boolean;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@
* you may not use this file except in compliance with the Elastic License.
*/

export type SchemaTypes = 'text' | 'number' | 'geolocation' | 'date';

export interface Schema {
[key: string]: SchemaTypes;
}

// this is a mapping of schema field types ("string", "number", "geolocation", "date") to the names
// of source engines which utilize that type
export type SchemaConflictFieldTypes = {
[key in SchemaTypes]: string[];
};

export interface SchemaConflict {
fieldTypes: SchemaConflictFieldTypes;
resolution?: string;
}

// For now these values are ISchemaConflictFieldTypes, but in the near future will be ISchemaConflict
// once we implement schema conflict resolution
export interface SchemaConflicts {
[key: string]: SchemaConflictFieldTypes;
}

export interface IIndexingStatus {
percentageComplete: number;
numDocumentsWithErrors: number;
Expand Down

0 comments on commit 4f3d72b

Please sign in to comment.