From ae73b8c47717071d6688f6cded91ebaf4cd34451 Mon Sep 17 00:00:00 2001 From: cea2aj <42848445+cea2aj@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:40:16 -0400 Subject: [PATCH 1/5] Document vertical support (#249) Introduce document vertical support Add segment, document, and documents to the result object J=BACK-2523 TEST=manual I connected the local test site to an experience with a document vertical setup and I confirmed that the segment was shown on the result. I still need to test the document and documents fields --- docs/search-core.document_2.documentscore.md | 13 ++++++++++++ docs/search-core.document_2.md | 21 +++++++++++++++++++ docs/search-core.document_2.segments.md | 13 ++++++++++++ docs/search-core.md | 2 ++ docs/search-core.result.document.md | 13 ++++++++++++ docs/search-core.result.documents.md | 13 ++++++++++++ docs/search-core.result.md | 3 +++ docs/search-core.result.segment.md | 13 ++++++++++++ docs/search-core.segment.md | 21 +++++++++++++++++++ docs/search-core.segment.score.md | 13 ++++++++++++ docs/search-core.segment.text.md | 13 ++++++++++++ docs/search-core.source.md | 1 + etc/search-core.api.md | 17 +++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- src/models/index.ts | 2 ++ src/models/searchservice/response/Document.ts | 13 ++++++++++++ src/models/searchservice/response/Result.ts | 16 +++++++++++++- src/models/searchservice/response/Segment.ts | 11 ++++++++++ src/models/searchservice/response/Source.ts | 4 +++- .../searchservice/ResultsFactory.ts | 18 ++++++++++++++++ 21 files changed, 221 insertions(+), 5 deletions(-) create mode 100644 docs/search-core.document_2.documentscore.md create mode 100644 docs/search-core.document_2.md create mode 100644 docs/search-core.document_2.segments.md create mode 100644 docs/search-core.result.document.md create mode 100644 docs/search-core.result.documents.md create mode 100644 docs/search-core.result.segment.md create mode 100644 docs/search-core.segment.md create mode 100644 docs/search-core.segment.score.md create mode 100644 docs/search-core.segment.text.md create mode 100644 src/models/searchservice/response/Document.ts create mode 100644 src/models/searchservice/response/Segment.ts diff --git a/docs/search-core.document_2.documentscore.md b/docs/search-core.document_2.documentscore.md new file mode 100644 index 00000000..c048b4ae --- /dev/null +++ b/docs/search-core.document_2.documentscore.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [Document\_2](./search-core.document_2.md) > [documentScore](./search-core.document_2.documentscore.md) + +## Document\_2.documentScore property + +The score calculated from whatever document search strategy was used. + +Signature: + +```typescript +documentScore: number; +``` diff --git a/docs/search-core.document_2.md b/docs/search-core.document_2.md new file mode 100644 index 00000000..eae472b0 --- /dev/null +++ b/docs/search-core.document_2.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [Document\_2](./search-core.document_2.md) + +## Document\_2 interface + +Details about the document and the document search algorithm + +Signature: + +```typescript +export interface Document +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [documentScore](./search-core.document_2.documentscore.md) | number | The score calculated from whatever document search strategy was used. | +| [segments](./search-core.document_2.segments.md) | [Segment](./search-core.segment.md)\[\] | All the relevant segments extracted from the document. | + diff --git a/docs/search-core.document_2.segments.md b/docs/search-core.document_2.segments.md new file mode 100644 index 00000000..c23eb2a6 --- /dev/null +++ b/docs/search-core.document_2.segments.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [Document\_2](./search-core.document_2.md) > [segments](./search-core.document_2.segments.md) + +## Document\_2.segments property + +All the relevant segments extracted from the document. + +Signature: + +```typescript +segments: Segment[]; +``` diff --git a/docs/search-core.md b/docs/search-core.md index ccbb1740..c96301f0 100644 --- a/docs/search-core.md +++ b/docs/search-core.md @@ -63,6 +63,7 @@ | [DisjunctionStaticFilter](./search-core.disjunctionstaticfilter.md) | A static filter composed by combining filters with the logical OR operator. The combined filters can either be field value filters or other disjunction filters. | | [DisplayableFacet](./search-core.displayablefacet.md) | A [Facet](./search-core.facet.md) which contains extra fields meant to be displayed to the end user. | | [DisplayableFacetOption](./search-core.displayablefacetoption.md) | A [FacetOption](./search-core.facetoption.md) with extra data meant to be displayed to the end user. | +| [Document\_2](./search-core.document_2.md) | Details about the document and the document search algorithm | | [EmailDirectAnswer](./search-core.emaildirectanswer.md) | A [BaseFieldValueDirectAnswer](./search-core.basefieldvaluedirectanswer.md) interface with 'email' field type. | | [Endpoints](./search-core.endpoints.md) | Overrides for the URLs which are used when making requests to the Search API. | | [FacebookUrlDirectAnswer](./search-core.facebookurldirectanswer.md) | A direct answer for a facebook url field. | @@ -105,6 +106,7 @@ | [SearchParameterField](./search-core.searchparameterfield.md) | Indicates which entity field to perform the autocomplete request on. | | [SearchRequest](./search-core.searchrequest.md) | Options for a Search API request. | | [SearchService](./search-core.searchservice.md) | A service which performs Yext Search. | +| [Segment](./search-core.segment.md) | A result produced by a document vertical. | | [ServingConfig](./search-core.servingconfig.md) | The configuration options for getting the endpoints. | | [Snippet](./search-core.snippet.md) | The section of text where a [FeaturedSnippetDirectAnswer](./search-core.featuredsnippetdirectanswer.md) was found. | | [SortBy](./search-core.sortby.md) | Represents a criterion that can be used to sort results. | diff --git a/docs/search-core.result.document.md b/docs/search-core.result.document.md new file mode 100644 index 00000000..4d8e99d4 --- /dev/null +++ b/docs/search-core.result.document.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [Result](./search-core.result.md) > [document](./search-core.result.document.md) + +## Result.document property + +A relevant document associated with the result. Present for document verticals grouped by Document. + +Signature: + +```typescript +document?: Document; +``` diff --git a/docs/search-core.result.documents.md b/docs/search-core.result.documents.md new file mode 100644 index 00000000..b1d36c83 --- /dev/null +++ b/docs/search-core.result.documents.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [Result](./search-core.result.md) > [documents](./search-core.result.documents.md) + +## Result.documents property + +All relevant documents associated with the result. Present for document verticals grouped by Entity. + +Signature: + +```typescript +documents?: Document[]; +``` diff --git a/docs/search-core.result.md b/docs/search-core.result.md index f7df95d7..8c22cd40 100644 --- a/docs/search-core.result.md +++ b/docs/search-core.result.md @@ -19,6 +19,8 @@ export interface Result> | [description?](./search-core.result.description.md) | string | (Optional) A description of the result. | | [distance?](./search-core.result.distance.md) | number | (Optional) The distance from the user to the result in meters. | | [distanceFromFilter?](./search-core.result.distancefromfilter.md) | number | (Optional) The distance from a [AppliedQueryFilter](./search-core.appliedqueryfilter.md) location to the result in meters. | +| [document?](./search-core.result.document.md) | Document | (Optional) A relevant document associated with the result. Present for document verticals grouped by Document. | +| [documents?](./search-core.result.documents.md) | Document\[\] | (Optional) All relevant documents associated with the result. Present for document verticals grouped by Entity. | | [entityType?](./search-core.result.entitytype.md) | string | (Optional) The entity type of the result. | | [highlightedFields?](./search-core.result.highlightedfields.md) | [HighlightedFields](./search-core.highlightedfields.md) | (Optional) The [highlighted fields](./search-core.highlightedfields.md) emphasized by the api. | | [id?](./search-core.result.id.md) | string | (Optional) The result ID which depends on the Result Source. | @@ -26,5 +28,6 @@ export interface Result> | [link?](./search-core.result.link.md) | string | (Optional) A hyperlink associated with the result. | | [name?](./search-core.result.name.md) | string | (Optional) The name of the result. | | [rawData](./search-core.result.rawdata.md) | T | Raw entity profile data in the shape of key-value pairs. | +| [segment?](./search-core.result.segment.md) | [Segment](./search-core.segment.md) | (Optional) A relevant segment associated with the result. Present for document verticals grouped by Segment. | | [source](./search-core.result.source.md) | [Source](./search-core.source.md) | Represents the source of a [Result](./search-core.result.md). | diff --git a/docs/search-core.result.segment.md b/docs/search-core.result.segment.md new file mode 100644 index 00000000..e7b561ce --- /dev/null +++ b/docs/search-core.result.segment.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [Result](./search-core.result.md) > [segment](./search-core.result.segment.md) + +## Result.segment property + +A relevant segment associated with the result. Present for document verticals grouped by Segment. + +Signature: + +```typescript +segment?: Segment; +``` diff --git a/docs/search-core.segment.md b/docs/search-core.segment.md new file mode 100644 index 00000000..c8755534 --- /dev/null +++ b/docs/search-core.segment.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [Segment](./search-core.segment.md) + +## Segment interface + +A result produced by a document vertical. + +Signature: + +```typescript +export interface Segment +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [score](./search-core.segment.score.md) | number | The similarity score of the segment from 0 to 1 | +| [text](./search-core.segment.text.md) | string | The value of the segment as plain text. | + diff --git a/docs/search-core.segment.score.md b/docs/search-core.segment.score.md new file mode 100644 index 00000000..52919b8a --- /dev/null +++ b/docs/search-core.segment.score.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [Segment](./search-core.segment.md) > [score](./search-core.segment.score.md) + +## Segment.score property + +The similarity score of the segment from 0 to 1 + +Signature: + +```typescript +score: number; +``` diff --git a/docs/search-core.segment.text.md b/docs/search-core.segment.text.md new file mode 100644 index 00000000..1eab48f6 --- /dev/null +++ b/docs/search-core.segment.text.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [Segment](./search-core.segment.md) > [text](./search-core.segment.text.md) + +## Segment.text property + +The value of the segment as plain text. + +Signature: + +```typescript +text: string; +``` diff --git a/docs/search-core.source.md b/docs/search-core.source.md index 23a39cf7..6dc1c3cd 100644 --- a/docs/search-core.source.md +++ b/docs/search-core.source.md @@ -19,6 +19,7 @@ export declare enum Source | Algolia | "ALGOLIA" | The result is from Algolia. | | Bing | "BING_CSE" | The result is from Bing Search Engine. | | Custom | "CUSTOM_SEARCHER" | The result was from a custom source. | +| DocumentVertical | "DOCUMENT_VERTICAL" | The result is from a document vertical. | | Google | "GOOGLE_CSE" | The result is from Google Custom Search Engine. | | KnowledgeManager | "KNOWLEDGE_MANAGER" | The result is from a Knowledge Graph. | | Zendesk | "ZENDESK" | The result is from Zendesk. | diff --git a/etc/search-core.api.md b/etc/search-core.api.md index 2d46a534..e0828374 100644 --- a/etc/search-core.api.md +++ b/etc/search-core.api.md @@ -255,6 +255,13 @@ export interface DisplayableFacetOption extends FacetOption { selected: boolean; } +// @public +interface Document_2 { + documentScore: number; + segments: Segment[]; +} +export { Document_2 as Document } + // @public export interface EmailDirectAnswer extends BaseFieldValueDirectAnswer { // (undocumented) @@ -594,6 +601,8 @@ export interface Result> { description?: string; distance?: number; distanceFromFilter?: number; + document?: Document; + documents?: Document[]; entityType?: string; highlightedFields?: HighlightedFields; id?: string; @@ -601,6 +610,7 @@ export interface Result> { link?: string; name?: string; rawData: T; + segment?: Segment; source: Source; } @@ -681,6 +691,12 @@ export interface SearchService { verticalSearch(request: VerticalSearchRequest): Promise; } +// @public +export interface Segment { + score: number; + text: string; +} + // @public export interface ServingConfig { cloudRegion?: CloudRegion; @@ -715,6 +731,7 @@ export enum Source { Algolia = "ALGOLIA", Bing = "BING_CSE", Custom = "CUSTOM_SEARCHER", + DocumentVertical = "DOCUMENT_VERTICAL", Google = "GOOGLE_CSE", KnowledgeManager = "KNOWLEDGE_MANAGER", Zendesk = "ZENDESK" diff --git a/package-lock.json b/package-lock.json index 1f7ce0ed..bd800263 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/search-core", - "version": "2.4.0", + "version": "2.5.0-alpha.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-core", - "version": "2.4.0", + "version": "2.5.0-alpha.0", "license": "BSD-3-Clause", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", diff --git a/package.json b/package.json index e3fed112..e5417ac8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-core", - "version": "2.4.0", + "version": "2.5.0-alpha.0", "description": "Typescript Networking Library for the Yext Search API", "main": "./dist/commonjs/src/index.js", "module": "./dist/esm/src/index.js", diff --git a/src/models/index.ts b/src/models/index.ts index 2c095d9c..bdbae09d 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -82,6 +82,8 @@ export { VerticalSearchResponse } from './searchservice/response/VerticalSearchR export { Snippet } from './searchservice/response/Snippet'; export { ErrorType } from './searchservice/response/ErrorType'; export { FailedVertical } from './searchservice/response/FailedVertical'; +export { Segment } from './searchservice/response/Segment'; +export { Document } from './searchservice/response/Document'; // Search service common models export { Matcher } from './searchservice/common/Matcher'; diff --git a/src/models/searchservice/response/Document.ts b/src/models/searchservice/response/Document.ts new file mode 100644 index 00000000..ed7b17b4 --- /dev/null +++ b/src/models/searchservice/response/Document.ts @@ -0,0 +1,13 @@ +import { Segment } from './Segment'; + +/** + * Details about the document and the document search algorithm + * + * @public + */ +export interface Document { + /** The score calculated from whatever document search strategy was used. */ + documentScore: number, + /** All the relevant segments extracted from the document. */ + segments: Segment[] +} \ No newline at end of file diff --git a/src/models/searchservice/response/Result.ts b/src/models/searchservice/response/Result.ts index c7996647..349b44ae 100644 --- a/src/models/searchservice/response/Result.ts +++ b/src/models/searchservice/response/Result.ts @@ -1,5 +1,6 @@ import { HighlightedFields } from './HighlightedFields'; import { Source } from './Source'; +import { Segment } from './Segment'; /** * An individual search result. @@ -39,5 +40,18 @@ export interface Result> { /** The {@link HighlightedFields | highlighted fields} emphasized by the api. */ highlightedFields?: HighlightedFields, /** The entity type of the result. */ - entityType?: string + entityType?: string, + /** A relevant segment associated with the result. Present for document verticals grouped by + * Segment. */ + segment?: Segment, + /** + * A relevant document associated with the result. Present for document verticals grouped by + * Document. + */ + document?: Document, + /** + * All relevant documents associated with the result. Present for document verticals grouped by + * Entity. + */ + documents?: Document[] } \ No newline at end of file diff --git a/src/models/searchservice/response/Segment.ts b/src/models/searchservice/response/Segment.ts new file mode 100644 index 00000000..bc8c5c8a --- /dev/null +++ b/src/models/searchservice/response/Segment.ts @@ -0,0 +1,11 @@ +/** + * A result produced by a document vertical. + * + * @public + */ +export interface Segment { + /** The value of the segment as plain text. */ + text: string, + /** The similarity score of the segment from 0 to 1 */ + score: number +} \ No newline at end of file diff --git a/src/models/searchservice/response/Source.ts b/src/models/searchservice/response/Source.ts index cdd8833f..ddbebe9d 100644 --- a/src/models/searchservice/response/Source.ts +++ b/src/models/searchservice/response/Source.ts @@ -15,5 +15,7 @@ export enum Source { /** The result is from Algolia. */ Algolia = 'ALGOLIA', /** The result was from a custom source. */ - Custom = 'CUSTOM_SEARCHER' + Custom = 'CUSTOM_SEARCHER', + /** The result is from a document vertical. */ + DocumentVertical = 'DOCUMENT_VERTICAL', } \ No newline at end of file diff --git a/src/transformers/searchservice/ResultsFactory.ts b/src/transformers/searchservice/ResultsFactory.ts index c4025336..944e1c4d 100644 --- a/src/transformers/searchservice/ResultsFactory.ts +++ b/src/transformers/searchservice/ResultsFactory.ts @@ -24,6 +24,8 @@ export class ResultsFactory { return this.fromZendeskSearchEngine(result, resultIndex); case Source.Algolia: return this.fromAlgoliaSearchEngine(result, resultIndex); + case Source.DocumentVertical: + return this.fromDocumentVertical(result, resultIndex); default: return this.fromCustomSource(result, resultIndex); } @@ -47,6 +49,22 @@ export class ResultsFactory { }; } + private static fromDocumentVertical(result: any, index: number): Result { + const rawData = result.data ?? result; + return { + rawData: rawData, + source: Source.DocumentVertical, + name: rawData.name, + description: rawData.description, + link: rawData.website, + id: rawData.id, + index: index, + segment: result.segment, + document: result.document, + documents: result.documents + }; + } + private static fromGoogleCustomSearchEngine(result: any, index: number): Result { const rawData = result.data ?? result; return { From cdff1b29ef9fc8a4fffc86c2bf4d926160706c8f Mon Sep 17 00:00:00 2001 From: cea2aj <42848445+cea2aj@users.noreply.github.com> Date: Fri, 29 Sep 2023 16:00:07 -0400 Subject: [PATCH 2/5] Rename Document to DocumentResult (#251) The type "Document" was conflicting with the same type in node and in the browser which was causing some TS issues. Renaming this fixes this conflict. J=BACK-2523 TEST=compile --- docs/search-core.document_2.md | 21 ------------------- ...arch-core.documentresult.documentscore.md} | 4 ++-- docs/search-core.documentresult.md | 21 +++++++++++++++++++ ...=> search-core.documentresult.segments.md} | 4 ++-- docs/search-core.md | 2 +- docs/search-core.result.document.md | 2 +- docs/search-core.result.documents.md | 2 +- docs/search-core.result.md | 6 +++--- docs/search-core.result.rawdata.md | 4 ++-- etc/search-core.api.md | 9 ++++---- package-lock.json | 4 ++-- package.json | 2 +- src/models/index.ts | 2 +- .../{Document.ts => DocumentResult.ts} | 2 +- src/models/searchservice/response/Result.ts | 9 ++++---- 15 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 docs/search-core.document_2.md rename docs/{search-core.document_2.documentscore.md => search-core.documentresult.documentscore.md} (61%) create mode 100644 docs/search-core.documentresult.md rename docs/{search-core.document_2.segments.md => search-core.documentresult.segments.md} (62%) rename src/models/searchservice/response/{Document.ts => DocumentResult.ts} (90%) diff --git a/docs/search-core.document_2.md b/docs/search-core.document_2.md deleted file mode 100644 index eae472b0..00000000 --- a/docs/search-core.document_2.md +++ /dev/null @@ -1,21 +0,0 @@ - - -[Home](./index.md) > [@yext/search-core](./search-core.md) > [Document\_2](./search-core.document_2.md) - -## Document\_2 interface - -Details about the document and the document search algorithm - -Signature: - -```typescript -export interface Document -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [documentScore](./search-core.document_2.documentscore.md) | number | The score calculated from whatever document search strategy was used. | -| [segments](./search-core.document_2.segments.md) | [Segment](./search-core.segment.md)\[\] | All the relevant segments extracted from the document. | - diff --git a/docs/search-core.document_2.documentscore.md b/docs/search-core.documentresult.documentscore.md similarity index 61% rename from docs/search-core.document_2.documentscore.md rename to docs/search-core.documentresult.documentscore.md index c048b4ae..8a61cc16 100644 --- a/docs/search-core.document_2.documentscore.md +++ b/docs/search-core.documentresult.documentscore.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [@yext/search-core](./search-core.md) > [Document\_2](./search-core.document_2.md) > [documentScore](./search-core.document_2.documentscore.md) +[Home](./index.md) > [@yext/search-core](./search-core.md) > [DocumentResult](./search-core.documentresult.md) > [documentScore](./search-core.documentresult.documentscore.md) -## Document\_2.documentScore property +## DocumentResult.documentScore property The score calculated from whatever document search strategy was used. diff --git a/docs/search-core.documentresult.md b/docs/search-core.documentresult.md new file mode 100644 index 00000000..df1ff79e --- /dev/null +++ b/docs/search-core.documentresult.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [@yext/search-core](./search-core.md) > [DocumentResult](./search-core.documentresult.md) + +## DocumentResult interface + +Details about the document and the document search algorithm + +Signature: + +```typescript +export interface DocumentResult +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [documentScore](./search-core.documentresult.documentscore.md) | number | The score calculated from whatever document search strategy was used. | +| [segments](./search-core.documentresult.segments.md) | [Segment](./search-core.segment.md)\[\] | All the relevant segments extracted from the document. | + diff --git a/docs/search-core.document_2.segments.md b/docs/search-core.documentresult.segments.md similarity index 62% rename from docs/search-core.document_2.segments.md rename to docs/search-core.documentresult.segments.md index c23eb2a6..ee6039c4 100644 --- a/docs/search-core.document_2.segments.md +++ b/docs/search-core.documentresult.segments.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [@yext/search-core](./search-core.md) > [Document\_2](./search-core.document_2.md) > [segments](./search-core.document_2.segments.md) +[Home](./index.md) > [@yext/search-core](./search-core.md) > [DocumentResult](./search-core.documentresult.md) > [segments](./search-core.documentresult.segments.md) -## Document\_2.segments property +## DocumentResult.segments property All the relevant segments extracted from the document. diff --git a/docs/search-core.md b/docs/search-core.md index c96301f0..3ca5a1c9 100644 --- a/docs/search-core.md +++ b/docs/search-core.md @@ -63,7 +63,7 @@ | [DisjunctionStaticFilter](./search-core.disjunctionstaticfilter.md) | A static filter composed by combining filters with the logical OR operator. The combined filters can either be field value filters or other disjunction filters. | | [DisplayableFacet](./search-core.displayablefacet.md) | A [Facet](./search-core.facet.md) which contains extra fields meant to be displayed to the end user. | | [DisplayableFacetOption](./search-core.displayablefacetoption.md) | A [FacetOption](./search-core.facetoption.md) with extra data meant to be displayed to the end user. | -| [Document\_2](./search-core.document_2.md) | Details about the document and the document search algorithm | +| [DocumentResult](./search-core.documentresult.md) | Details about the document and the document search algorithm | | [EmailDirectAnswer](./search-core.emaildirectanswer.md) | A [BaseFieldValueDirectAnswer](./search-core.basefieldvaluedirectanswer.md) interface with 'email' field type. | | [Endpoints](./search-core.endpoints.md) | Overrides for the URLs which are used when making requests to the Search API. | | [FacebookUrlDirectAnswer](./search-core.facebookurldirectanswer.md) | A direct answer for a facebook url field. | diff --git a/docs/search-core.result.document.md b/docs/search-core.result.document.md index 4d8e99d4..7b181f7b 100644 --- a/docs/search-core.result.document.md +++ b/docs/search-core.result.document.md @@ -9,5 +9,5 @@ A relevant document associated with the result. Present for document verticals g Signature: ```typescript -document?: Document; +document?: DocumentResult; ``` diff --git a/docs/search-core.result.documents.md b/docs/search-core.result.documents.md index b1d36c83..d0252799 100644 --- a/docs/search-core.result.documents.md +++ b/docs/search-core.result.documents.md @@ -9,5 +9,5 @@ All relevant documents associated with the result. Present for document vertical Signature: ```typescript -documents?: Document[]; +documents?: DocumentResult[]; ``` diff --git a/docs/search-core.result.md b/docs/search-core.result.md index 8c22cd40..b0640604 100644 --- a/docs/search-core.result.md +++ b/docs/search-core.result.md @@ -19,15 +19,15 @@ export interface Result> | [description?](./search-core.result.description.md) | string | (Optional) A description of the result. | | [distance?](./search-core.result.distance.md) | number | (Optional) The distance from the user to the result in meters. | | [distanceFromFilter?](./search-core.result.distancefromfilter.md) | number | (Optional) The distance from a [AppliedQueryFilter](./search-core.appliedqueryfilter.md) location to the result in meters. | -| [document?](./search-core.result.document.md) | Document | (Optional) A relevant document associated with the result. Present for document verticals grouped by Document. | -| [documents?](./search-core.result.documents.md) | Document\[\] | (Optional) All relevant documents associated with the result. Present for document verticals grouped by Entity. | +| [document?](./search-core.result.document.md) | [DocumentResult](./search-core.documentresult.md) | (Optional) A relevant document associated with the result. Present for document verticals grouped by Document. | +| [documents?](./search-core.result.documents.md) | [DocumentResult](./search-core.documentresult.md)\[\] | (Optional) All relevant documents associated with the result. Present for document verticals grouped by Entity. | | [entityType?](./search-core.result.entitytype.md) | string | (Optional) The entity type of the result. | | [highlightedFields?](./search-core.result.highlightedfields.md) | [HighlightedFields](./search-core.highlightedfields.md) | (Optional) The [highlighted fields](./search-core.highlightedfields.md) emphasized by the api. | | [id?](./search-core.result.id.md) | string | (Optional) The result ID which depends on the Result Source. | | [index?](./search-core.result.index.md) | number | (Optional) The index of the result among the other results in the search. | | [link?](./search-core.result.link.md) | string | (Optional) A hyperlink associated with the result. | | [name?](./search-core.result.name.md) | string | (Optional) The name of the result. | -| [rawData](./search-core.result.rawdata.md) | T | Raw entity profile data in the shape of key-value pairs. | +| [rawData](./search-core.result.rawdata.md) | T \| T\[\] | Raw entity profile data in the shape of key-value pairs, or as an array of key-value pairs. | | [segment?](./search-core.result.segment.md) | [Segment](./search-core.segment.md) | (Optional) A relevant segment associated with the result. Present for document verticals grouped by Segment. | | [source](./search-core.result.source.md) | [Source](./search-core.source.md) | Represents the source of a [Result](./search-core.result.md). | diff --git a/docs/search-core.result.rawdata.md b/docs/search-core.result.rawdata.md index a7f0b912..de2a045f 100644 --- a/docs/search-core.result.rawdata.md +++ b/docs/search-core.result.rawdata.md @@ -4,10 +4,10 @@ ## Result.rawData property -Raw entity profile data in the shape of key-value pairs. +Raw entity profile data in the shape of key-value pairs, or as an array of key-value pairs. Signature: ```typescript -rawData: T; +rawData: T | T[]; ``` diff --git a/etc/search-core.api.md b/etc/search-core.api.md index e0828374..d4cd0453 100644 --- a/etc/search-core.api.md +++ b/etc/search-core.api.md @@ -256,11 +256,10 @@ export interface DisplayableFacetOption extends FacetOption { } // @public -interface Document_2 { +export interface DocumentResult { documentScore: number; segments: Segment[]; } -export { Document_2 as Document } // @public export interface EmailDirectAnswer extends BaseFieldValueDirectAnswer { @@ -601,15 +600,15 @@ export interface Result> { description?: string; distance?: number; distanceFromFilter?: number; - document?: Document; - documents?: Document[]; + document?: DocumentResult; + documents?: DocumentResult[]; entityType?: string; highlightedFields?: HighlightedFields; id?: string; index?: number; link?: string; name?: string; - rawData: T; + rawData: T | T[]; segment?: Segment; source: Source; } diff --git a/package-lock.json b/package-lock.json index bd800263..ca774d91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/search-core", - "version": "2.5.0-alpha.0", + "version": "2.5.0-beta.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-core", - "version": "2.5.0-alpha.0", + "version": "2.5.0-beta.0", "license": "BSD-3-Clause", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", diff --git a/package.json b/package.json index e5417ac8..20bb3ed3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-core", - "version": "2.5.0-alpha.0", + "version": "2.5.0-beta.1", "description": "Typescript Networking Library for the Yext Search API", "main": "./dist/commonjs/src/index.js", "module": "./dist/esm/src/index.js", diff --git a/src/models/index.ts b/src/models/index.ts index bdbae09d..369e4a4f 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -83,7 +83,7 @@ export { Snippet } from './searchservice/response/Snippet'; export { ErrorType } from './searchservice/response/ErrorType'; export { FailedVertical } from './searchservice/response/FailedVertical'; export { Segment } from './searchservice/response/Segment'; -export { Document } from './searchservice/response/Document'; +export { DocumentResult } from './searchservice/response/DocumentResult'; // Search service common models export { Matcher } from './searchservice/common/Matcher'; diff --git a/src/models/searchservice/response/Document.ts b/src/models/searchservice/response/DocumentResult.ts similarity index 90% rename from src/models/searchservice/response/Document.ts rename to src/models/searchservice/response/DocumentResult.ts index ed7b17b4..248a35b2 100644 --- a/src/models/searchservice/response/Document.ts +++ b/src/models/searchservice/response/DocumentResult.ts @@ -5,7 +5,7 @@ import { Segment } from './Segment'; * * @public */ -export interface Document { +export interface DocumentResult { /** The score calculated from whatever document search strategy was used. */ documentScore: number, /** All the relevant segments extracted from the document. */ diff --git a/src/models/searchservice/response/Result.ts b/src/models/searchservice/response/Result.ts index 349b44ae..b1cf07a9 100644 --- a/src/models/searchservice/response/Result.ts +++ b/src/models/searchservice/response/Result.ts @@ -1,6 +1,7 @@ import { HighlightedFields } from './HighlightedFields'; import { Source } from './Source'; import { Segment } from './Segment'; +import { DocumentResult } from './DocumentResult'; /** * An individual search result. @@ -8,8 +9,8 @@ import { Segment } from './Segment'; * @public */ export interface Result> { - /** Raw entity profile data in the shape of key-value pairs. */ - rawData: T, + /** Raw entity profile data in the shape of key-value pairs, or as an array of key-value pairs. */ + rawData: T | T[], /** {@inheritDoc Source} */ source: Source, /** The index of the result among the other results in the search. */ @@ -48,10 +49,10 @@ export interface Result> { * A relevant document associated with the result. Present for document verticals grouped by * Document. */ - document?: Document, + document?: DocumentResult, /** * All relevant documents associated with the result. Present for document verticals grouped by * Entity. */ - documents?: Document[] + documents?: DocumentResult[] } \ No newline at end of file From fbe7b92846675afc56f63c81a4cb4a669afe6932 Mon Sep 17 00:00:00 2001 From: Connor Anderson Date: Fri, 29 Sep 2023 16:42:45 -0400 Subject: [PATCH 3/5] Bump version to v2.5.0-beta.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ca774d91..8c8584dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/search-core", - "version": "2.5.0-beta.0", + "version": "2.5.0-beta.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-core", - "version": "2.5.0-beta.0", + "version": "2.5.0-beta.2", "license": "BSD-3-Clause", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", diff --git a/package.json b/package.json index 20bb3ed3..1baf7f83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-core", - "version": "2.5.0-beta.1", + "version": "2.5.0-beta.2", "description": "Typescript Networking Library for the Yext Search API", "main": "./dist/commonjs/src/index.js", "module": "./dist/esm/src/index.js", From eec271ead3df85a67063989211d41dd3448d99bf Mon Sep 17 00:00:00 2001 From: cea2aj <42848445+cea2aj@users.noreply.github.com> Date: Fri, 29 Sep 2023 17:52:10 -0400 Subject: [PATCH 4/5] Remove rawData array type (#252) It turns out this change was unnecessary because someone could pass an array as the generic J=BACK-2523 TEST=compile --- docs/search-core.result.md | 2 +- docs/search-core.result.rawdata.md | 2 +- etc/search-core.api.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/models/searchservice/response/Result.ts | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/search-core.result.md b/docs/search-core.result.md index b0640604..3368294c 100644 --- a/docs/search-core.result.md +++ b/docs/search-core.result.md @@ -27,7 +27,7 @@ export interface Result> | [index?](./search-core.result.index.md) | number | (Optional) The index of the result among the other results in the search. | | [link?](./search-core.result.link.md) | string | (Optional) A hyperlink associated with the result. | | [name?](./search-core.result.name.md) | string | (Optional) The name of the result. | -| [rawData](./search-core.result.rawdata.md) | T \| T\[\] | Raw entity profile data in the shape of key-value pairs, or as an array of key-value pairs. | +| [rawData](./search-core.result.rawdata.md) | T | Raw entity profile data in the shape of key-value pairs, or as an array of key-value pairs. | | [segment?](./search-core.result.segment.md) | [Segment](./search-core.segment.md) | (Optional) A relevant segment associated with the result. Present for document verticals grouped by Segment. | | [source](./search-core.result.source.md) | [Source](./search-core.source.md) | Represents the source of a [Result](./search-core.result.md). | diff --git a/docs/search-core.result.rawdata.md b/docs/search-core.result.rawdata.md index de2a045f..08758828 100644 --- a/docs/search-core.result.rawdata.md +++ b/docs/search-core.result.rawdata.md @@ -9,5 +9,5 @@ Raw entity profile data in the shape of key-value pairs, or as an array of key-v Signature: ```typescript -rawData: T | T[]; +rawData: T; ``` diff --git a/etc/search-core.api.md b/etc/search-core.api.md index d4cd0453..5a9823ed 100644 --- a/etc/search-core.api.md +++ b/etc/search-core.api.md @@ -608,7 +608,7 @@ export interface Result> { index?: number; link?: string; name?: string; - rawData: T | T[]; + rawData: T; segment?: Segment; source: Source; } diff --git a/package-lock.json b/package-lock.json index 8c8584dd..c5b23bf4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/search-core", - "version": "2.5.0-beta.2", + "version": "2.5.0-beta.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-core", - "version": "2.5.0-beta.2", + "version": "2.5.0-beta.3", "license": "BSD-3-Clause", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", diff --git a/package.json b/package.json index 1baf7f83..a7a462ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-core", - "version": "2.5.0-beta.2", + "version": "2.5.0-beta.3", "description": "Typescript Networking Library for the Yext Search API", "main": "./dist/commonjs/src/index.js", "module": "./dist/esm/src/index.js", diff --git a/src/models/searchservice/response/Result.ts b/src/models/searchservice/response/Result.ts index b1cf07a9..047b0558 100644 --- a/src/models/searchservice/response/Result.ts +++ b/src/models/searchservice/response/Result.ts @@ -10,7 +10,7 @@ import { DocumentResult } from './DocumentResult'; */ export interface Result> { /** Raw entity profile data in the shape of key-value pairs, or as an array of key-value pairs. */ - rawData: T | T[], + rawData: T, /** {@inheritDoc Source} */ source: Source, /** The index of the result among the other results in the search. */ From a14facc9757d97cf80841331fa5b398e0ba12f67 Mon Sep 17 00:00:00 2001 From: nmanu1 <88398086+nmanu1@users.noreply.github.com> Date: Thu, 7 Dec 2023 16:26:17 -0500 Subject: [PATCH 5/5] Bump version to v2.5.0 (#256) Bump package version to v2.5.0. J=none TEST=auto --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9ad6fced..f7b379f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/search-core", - "version": "2.5.0-beta.3", + "version": "2.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-core", - "version": "2.5.0-beta.3", + "version": "2.5.0", "license": "BSD-3-Clause", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", diff --git a/package.json b/package.json index a7a462ed..97c2305e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-core", - "version": "2.5.0-beta.3", + "version": "2.5.0", "description": "Typescript Networking Library for the Yext Search API", "main": "./dist/commonjs/src/index.js", "module": "./dist/esm/src/index.js",