clean up api report for search-backend-node package
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
@@ -28,7 +28,8 @@ import {
|
||||
} from './types';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Used for adding collators, decorators and compile them into tasks which are added to a scheduler returned to the caller.
|
||||
* @public
|
||||
*/
|
||||
export class IndexBuilder {
|
||||
private collators: Record<string, RegisterCollatorParameters>;
|
||||
@@ -45,10 +46,16 @@ export class IndexBuilder {
|
||||
this.searchEngine = searchEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Responsible for returning the registered search engine.
|
||||
*/
|
||||
getSearchEngine(): SearchEngine {
|
||||
return this.searchEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Responsible for returning the registered document types.
|
||||
*/
|
||||
getDocumentTypes(): Record<string, DocumentTypeInfo> {
|
||||
return this.documentTypes;
|
||||
}
|
||||
|
||||
@@ -24,16 +24,18 @@ type TaskEnvelope = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @public ScheduleTaskParameters
|
||||
* ScheduleTaskParameters
|
||||
* @public
|
||||
*/
|
||||
export interface ScheduleTaskParameters {
|
||||
export type ScheduleTaskParameters = {
|
||||
id: string;
|
||||
task: TaskFunction;
|
||||
scheduledRunner: TaskRunner;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Scheduler responsible for all search tasks.
|
||||
* @public
|
||||
*/
|
||||
export class Scheduler {
|
||||
private logger: Logger;
|
||||
|
||||
@@ -23,7 +23,8 @@ import { Readable } from 'stream';
|
||||
import { Logger } from 'winston';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Options for instansiate NewlineDelimitedJsonCollatorFactory
|
||||
* @public
|
||||
*/
|
||||
export type NewlineDelimitedJsonCollatorFactoryOptions = {
|
||||
type: string;
|
||||
@@ -60,15 +61,13 @@ export type NewlineDelimitedJsonCollatorFactoryOptions = {
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @beta
|
||||
* @public
|
||||
*/
|
||||
export class NewlineDelimitedJsonCollatorFactory
|
||||
implements DocumentCollatorFactory
|
||||
{
|
||||
/** {@inheritDoc @backstage/plugin-search-common#DocumentCollatorFactory."type"} */
|
||||
readonly type: string;
|
||||
|
||||
/** {@inheritDoc @backstage/plugin-search-common#DocumentCollatorFactory.visibilityPermission} */
|
||||
public readonly visibilityPermission: Permission | undefined;
|
||||
|
||||
private constructor(
|
||||
@@ -123,7 +122,6 @@ export class NewlineDelimitedJsonCollatorFactory
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc @backstage/plugin-search-common#DocumentCollatorFactory.getCollator} */
|
||||
async getCollator(): Promise<Readable> {
|
||||
// Search for files matching the given pattern.
|
||||
const lastUrl = await this.lastUrl();
|
||||
|
||||
@@ -27,7 +27,8 @@ import { Logger } from 'winston';
|
||||
import { LunrSearchEngineIndexer } from './LunrSearchEngineIndexer';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Type of translated query for the Lunr Search Engine.
|
||||
* @public
|
||||
*/
|
||||
export type ConcreteLunrQuery = {
|
||||
lunrQueryBuilder: lunr.Index.QueryBuilder;
|
||||
@@ -41,12 +42,14 @@ type LunrResultEnvelope = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Translator repsonsible for translating search term and filters to a query that the Lunr Search Engine understands.
|
||||
* @public
|
||||
*/
|
||||
export type LunrQueryTranslator = (query: SearchQuery) => ConcreteLunrQuery;
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Lunr specific search engine implementation.
|
||||
* @public
|
||||
*/
|
||||
export class LunrSearchEngine implements SearchEngine {
|
||||
protected lunrIndices: Record<string, lunr.Index> = {};
|
||||
|
||||
@@ -19,7 +19,8 @@ import lunr from 'lunr';
|
||||
import { BatchSearchEngineIndexer } from '../indexing';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Lunr specific search engine indexer
|
||||
* @public
|
||||
*/
|
||||
export class LunrSearchEngineIndexer extends BatchSearchEngineIndexer {
|
||||
private schemaInitialized = false;
|
||||
|
||||
@@ -19,7 +19,8 @@ import { IndexableDocument } from '@backstage/plugin-search-common';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Options for {@link BatchSearchEngineIndexer}
|
||||
* @public
|
||||
*/
|
||||
export type BatchSearchEngineOptions = {
|
||||
batchSize: number;
|
||||
@@ -28,7 +29,7 @@ export type BatchSearchEngineOptions = {
|
||||
/**
|
||||
* Base class encapsulating batch-based stream processing. Useful as a base
|
||||
* class for search engine indexers.
|
||||
* @beta
|
||||
* @public
|
||||
*/
|
||||
export abstract class BatchSearchEngineIndexer extends Writable {
|
||||
private batchSize: number;
|
||||
|
||||
@@ -21,7 +21,7 @@ import { Transform } from 'stream';
|
||||
/**
|
||||
* Base class encapsulating simple async transformations. Useful as a base
|
||||
* class for Backstage search decorators.
|
||||
* @beta
|
||||
* @public
|
||||
*/
|
||||
export abstract class DecoratorBase extends Transform {
|
||||
private initialized: Promise<undefined | Error>;
|
||||
|
||||
@@ -19,7 +19,7 @@ import { pipeline, Readable, Transform, Writable } from 'stream';
|
||||
|
||||
/**
|
||||
* Object resolved after a test pipeline is executed.
|
||||
* @beta
|
||||
* @public
|
||||
*/
|
||||
export type TestPipelineResult = {
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ export type TestPipelineResult = {
|
||||
|
||||
/**
|
||||
* Test utility for Backstage Search collators, decorators, and indexers.
|
||||
* @beta
|
||||
* @public
|
||||
*/
|
||||
export class TestPipeline {
|
||||
private collator?: Readable;
|
||||
|
||||
@@ -23,7 +23,8 @@ import {
|
||||
import { Logger } from 'winston';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Options required to instantiate the index builder.
|
||||
* @public
|
||||
*/
|
||||
export type IndexBuilderOptions = {
|
||||
searchEngine: SearchEngine;
|
||||
@@ -32,7 +33,7 @@ export type IndexBuilderOptions = {
|
||||
|
||||
/**
|
||||
* Parameters required to register a collator.
|
||||
* @beta
|
||||
* @public
|
||||
*/
|
||||
export interface RegisterCollatorParameters {
|
||||
/**
|
||||
@@ -48,7 +49,7 @@ export interface RegisterCollatorParameters {
|
||||
|
||||
/**
|
||||
* Parameters required to register a decorator
|
||||
* @beta
|
||||
* @public
|
||||
*/
|
||||
export interface RegisterDecoratorParameters {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user