Skip to main content
Version: Next

NewlineDelimitedJsonCollatorFactory

Home > @backstage/plugin-search-backend-node > NewlineDelimitedJsonCollatorFactory

Factory class producing a collator that can be used to index documents sourced from the latest newline delimited JSON file matching a given search pattern. "Latest" is determined by the name of the file (last alphabetically is considered latest).

Signature:

class NewlineDelimitedJsonCollatorFactory implements DocumentCollatorFactory 

Implements: DocumentCollatorFactory

Remarks

The reader provided must implement the search() method as well as the readUrl method whose response includes the stream() method. Naturally, the reader must also be configured to understand the given search pattern.

Example

Here's an example configuration using Google Cloud Storage, which would return the latest file under the bucket GCS bucket with files like xyz-2021.ndjson or xyz-2022.ndjson.

indexBuilder.addCollator({
schedule,
factory: NewlineDelimitedJsonCollatorFactory.fromConfig(env.config, {
type: 'techdocs',
searchPattern: 'https://storage.cloud.google.com/bucket/xyz-*',
reader: env.reader,
logger: env.logger,
})
});

Properties

Property

Modifiers

Type

Description

type

readonly

string

visibilityPermission

readonly

Permission | undefined

Methods

Method

Modifiers

Description

fromConfig(_config, options)

static

Returns a NewlineDelimitedJsonCollatorFactory instance from configuration and a set of options.

getCollator()