Update AuthorizedSearchEngine for stream-based indexing.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-02-26 21:28:11 +01:00
parent 022507c860
commit 37b9ff3b19
2 changed files with 4 additions and 4 deletions
@@ -62,7 +62,7 @@ describe('AuthorizedSearchEngine', () => {
setTranslator: () => {
throw new Error('Function not implemented. 1');
},
index: () => {
getIndexer: () => {
throw new Error('Function not implemented.2');
},
query: mockedQuery,
@@ -25,7 +25,6 @@ import {
} from '@backstage/plugin-permission-common';
import {
DocumentTypeInfo,
IndexableDocument,
QueryRequestOptions,
QueryTranslator,
SearchEngine,
@@ -35,6 +34,7 @@ import {
} from '@backstage/search-common';
import { Config } from '@backstage/config';
import { InputError } from '@backstage/errors';
import { Writable } from 'stream';
export function decodePageCursor(pageCursor?: string): { page: number } {
if (!pageCursor) {
@@ -78,8 +78,8 @@ export class AuthorizedSearchEngine implements SearchEngine {
this.searchEngine.setTranslator(translator);
}
async index(type: string, documents: IndexableDocument[]): Promise<void> {
this.searchEngine.index(type, documents);
async getIndexer(type: string): Promise<Writable> {
return this.searchEngine.getIndexer(type);
}
async query(