Merge pull request #11175 from backstage/search/batch-size-default

[Search] Use batchSize of 1000 by default
This commit is contained in:
Eric Peterson
2022-05-04 12:53:14 +02:00
committed by GitHub
5 changed files with 11 additions and 4 deletions
@@ -53,7 +53,7 @@ export class ElasticSearchSearchEngineIndexer extends BatchSearchEngineIndexer {
private bulkResult: Promise<any>;
constructor(options: ElasticSearchSearchEngineIndexerOptions) {
super({ batchSize: 100 });
super({ batchSize: 1000 });
this.logger = options.logger;
this.startTimestamp = process.hrtime();
this.type = options.type;
@@ -136,7 +136,7 @@ describe('PgSearchEngine', () => {
// Indexer instantiated with expected args.
expect(PgSearchEngineIndexer).toHaveBeenCalledWith(
expect.objectContaining({
batchSize: 100,
batchSize: 1000,
type: 'my-type',
databaseStore: database,
}),
@@ -78,7 +78,7 @@ export class PgSearchEngine implements SearchEngine {
async getIndexer(type: string) {
return new PgSearchEngineIndexer({
batchSize: 100,
batchSize: 1000,
type,
databaseStore: this.databaseStore,
});
@@ -27,7 +27,7 @@ export class LunrSearchEngineIndexer extends BatchSearchEngineIndexer {
private docStore: Record<string, IndexableDocument> = {};
constructor() {
super({ batchSize: 100 });
super({ batchSize: 1000 });
this.builder = new lunr.Builder();
this.builder.pipeline.add(lunr.trimmer, lunr.stopWordFilter, lunr.stemmer);