@backstage/search-common
Advanced tools
Comparing version 0.2.4 to 0.3.0
# @backstage/search-common | ||
## 0.3.0 | ||
### Minor Changes | ||
- 022507c860: **BREAKING** | ||
The Backstage Search Platform's indexing process has been rewritten as a stream | ||
pipeline in order to improve efficiency and performance on large document sets. | ||
The concepts of `Collator` and `Decorator` have been replaced with readable and | ||
transform object streams (respectively), as well as factory classes to | ||
instantiate them. Accordingly, the `SearchEngine.index()` method has also been | ||
replaced with a `getIndexer()` factory method that resolves to a writable | ||
object stream. | ||
Check [this upgrade guide](https://backstage.io/docs/features/search/how-to-guides#how-to-migrate-from-search-alpha-to-beta) | ||
for further details. | ||
### Patch Changes | ||
- Updated dependencies | ||
- @backstage/plugin-permission-common@0.5.2 | ||
## 0.2.4 | ||
@@ -4,0 +27,0 @@ |
@@ -0,4 +1,9 @@ | ||
/// <reference types="node" /> | ||
import { Permission } from '@backstage/plugin-permission-common'; | ||
import { JsonObject } from '@backstage/types'; | ||
import { Readable, Transform, Writable } from 'stream'; | ||
/** | ||
* @beta | ||
*/ | ||
interface SearchQuery { | ||
@@ -10,2 +15,5 @@ term: string; | ||
} | ||
/** | ||
* @beta | ||
*/ | ||
interface SearchResult { | ||
@@ -15,2 +23,5 @@ type: string; | ||
} | ||
/** | ||
* @beta | ||
*/ | ||
interface SearchResultSet { | ||
@@ -24,2 +35,3 @@ results: SearchResult[]; | ||
* common properties that documents are encouraged to use where appropriate. | ||
* @beta | ||
*/ | ||
@@ -55,2 +67,3 @@ interface IndexableDocument { | ||
* about the types stored in the index. | ||
* @beta | ||
*/ | ||
@@ -65,6 +78,6 @@ declare type DocumentTypeInfo = { | ||
/** | ||
* Interface that must be implemented in order to expose new documents to | ||
* search. | ||
* Factory class for instantiating collators. | ||
* @beta | ||
*/ | ||
interface DocumentCollator { | ||
interface DocumentCollatorFactory { | ||
/** | ||
@@ -80,9 +93,12 @@ * The type or name of the document set returned by this collator. Used as an | ||
readonly visibilityPermission?: Permission; | ||
execute(): Promise<IndexableDocument[]>; | ||
/** | ||
* Instantiates and resolves a document collator. | ||
*/ | ||
getCollator(): Promise<Readable>; | ||
} | ||
/** | ||
* Interface that must be implemented in order to decorate existing documents with | ||
* additional metadata. | ||
* Factory class for instantiating decorators. | ||
* @beta | ||
*/ | ||
interface DocumentDecorator { | ||
interface DocumentDecoratorFactory { | ||
/** | ||
@@ -94,3 +110,6 @@ * An optional array of document/index types on which this decorator should | ||
readonly types?: string[]; | ||
execute(documents: IndexableDocument[]): Promise<IndexableDocument[]>; | ||
/** | ||
* Instantiates and resolves a document decorator. | ||
*/ | ||
getDecorator(): Promise<Transform>; | ||
} | ||
@@ -100,4 +119,9 @@ /** | ||
* a concrete query relevant to a particular search engine. | ||
* @beta | ||
*/ | ||
declare type QueryTranslator = (query: SearchQuery) => unknown; | ||
/** | ||
* Options when querying a search engine. | ||
* @beta | ||
*/ | ||
declare type QueryRequestOptions = { | ||
@@ -110,2 +134,3 @@ token?: string; | ||
* concrete, search engine-specific queries. | ||
* @beta | ||
*/ | ||
@@ -118,5 +143,11 @@ interface SearchEngine { | ||
/** | ||
* Add the given documents to the SearchEngine index of the given type. | ||
* Factory method for getting a search engine indexer for a given document | ||
* type. | ||
* | ||
* @param type - The type or name of the document set for which an indexer | ||
* should be retrieved. This corresponds to the `type` property on the | ||
* document collator/decorator factories and will most often be used to | ||
* identify an index or group to which documents should be written. | ||
*/ | ||
index(type: string, documents: IndexableDocument[]): Promise<void>; | ||
getIndexer(type: string): Promise<Writable>; | ||
/** | ||
@@ -128,2 +159,2 @@ * Perform a search query against the SearchEngine. | ||
export { DocumentCollator, DocumentDecorator, DocumentTypeInfo, IndexableDocument, QueryRequestOptions, QueryTranslator, SearchEngine, SearchQuery, SearchResult, SearchResultSet }; | ||
export { DocumentCollatorFactory, DocumentDecoratorFactory, DocumentTypeInfo, IndexableDocument, QueryRequestOptions, QueryTranslator, SearchEngine, SearchQuery, SearchResult, SearchResultSet }; |
{ | ||
"name": "@backstage/search-common", | ||
"description": "Common functionalities for Search, to be shared between various search-enabled plugins", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"main": "dist/index.cjs.js", | ||
@@ -42,7 +42,7 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@backstage/plugin-permission-common": "^0.5.1", | ||
"@backstage/plugin-permission-common": "^0.5.2", | ||
"@backstage/types": "^0.1.3" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "^0.14.0" | ||
"@backstage/cli": "^0.15.0" | ||
}, | ||
@@ -54,3 +54,3 @@ "jest": { | ||
}, | ||
"gitHead": "e244b348c473700e7d5e5fbcef38bd9f9fd1d0ba" | ||
"gitHead": "04bb0dd824b78f6b57dac62c3015e681f094045c" | ||
} |
22304
150