Skip to content

Commit

Permalink
Merge 1983eaf into facc939
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannzhou committed Aug 11, 2022
2 parents facc939 + 1983eaf commit 04ffcb9
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 35 deletions.
20 changes: 20 additions & 0 deletions docs/search-core.builtinfieldtype.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-core](./search-core.md) &gt; [BuiltInFieldType](./search-core.builtinfieldtype.md)

## BuiltInFieldType enum

Possible built-in field types for [DirectAnswer.fieldType](./search-core.directanswer.fieldtype.md)<!-- -->.

<b>Signature:</b>

```typescript
export declare enum BuiltInFieldType
```

## Enumeration Members

| Member | Value | Description |
| --- | --- | --- |
| Address | <code>&quot;address&quot;</code> | |

2 changes: 1 addition & 1 deletion docs/search-core.directanswer.fieldtype.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ The field type of the direct answer.
<b>Signature:</b>

```typescript
fieldType: string;
fieldType: BuiltInFieldType | string;
```
6 changes: 3 additions & 3 deletions docs/search-core.directanswer.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ A direct answer to a search.
<b>Signature:</b>

```typescript
export interface DirectAnswer
export interface DirectAnswer<T = unknown>
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [fieldType](./search-core.directanswer.fieldtype.md) | string | The field type of the direct answer. |
| [fieldType](./search-core.directanswer.fieldtype.md) | [BuiltInFieldType](./search-core.builtinfieldtype.md) \| string | The field type of the direct answer. |
| [relatedResult](./search-core.directanswer.relatedresult.md) | [Result](./search-core.result.md) | The entity associated with the direct answer. |
| [type](./search-core.directanswer.type.md) | [DirectAnswerType](./search-core.directanswertype.md) | The [DirectAnswerType](./search-core.directanswertype.md)<!-- -->. |
| [value?](./search-core.directanswer.value.md) | string | <i>(Optional)</i> The result of the direct answer. |
| [value?](./search-core.directanswer.value.md) | T | <i>(Optional)</i> The result of the direct answer. |
| [verticalKey](./search-core.directanswer.verticalkey.md) | string | The vertical key of the direct answer. |

2 changes: 1 addition & 1 deletion docs/search-core.directanswer.value.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The result of the direct answer.
<b>Signature:</b>

```typescript
value?: string;
value?: T;
```

## Remarks
Expand Down
2 changes: 1 addition & 1 deletion docs/search-core.featuredsnippetdirectanswer.fieldtype.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ The field type of the direct answer.
<b>Signature:</b>

```typescript
fieldType: string;
fieldType: BuiltInFieldType | string;
```
8 changes: 4 additions & 4 deletions docs/search-core.featuredsnippetdirectanswer.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ A direct answer which was found within a document.
<b>Signature:</b>

```typescript
export interface FeaturedSnippetDirectAnswer extends DirectAnswer
export interface FeaturedSnippetDirectAnswer<T = unknown> extends DirectAnswer<T>
```
<b>Extends:</b> [DirectAnswer](./search-core.directanswer.md)
<b>Extends:</b> [DirectAnswer](./search-core.directanswer.md)<!-- -->&lt;T&gt;
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [fieldType](./search-core.featuredsnippetdirectanswer.fieldtype.md) | string | The field type of the direct answer. |
| [fieldType](./search-core.featuredsnippetdirectanswer.fieldtype.md) | [BuiltInFieldType](./search-core.builtinfieldtype.md) \| string | The field type of the direct answer. |
| [relatedResult](./search-core.featuredsnippetdirectanswer.relatedresult.md) | [Result](./search-core.result.md) | The entity associated with the direct answer. |
| [snippet](./search-core.featuredsnippetdirectanswer.snippet.md) | [Snippet](./search-core.snippet.md) | The snippet where the direct answer was found. |
| [type](./search-core.featuredsnippetdirectanswer.type.md) | [DirectAnswerType.FeaturedSnippet](./search-core.directanswertype.md) | [DirectAnswerType](./search-core.directanswertype.md)<!-- -->.FeaturedSnippet. |
| [value?](./search-core.featuredsnippetdirectanswer.value.md) | string | <i>(Optional)</i> The result of the direct answer. |
| [value?](./search-core.featuredsnippetdirectanswer.value.md) | T | <i>(Optional)</i> The result of the direct answer. |
| [verticalKey](./search-core.featuredsnippetdirectanswer.verticalkey.md) | string | The vertical key of the direct answer. |
2 changes: 1 addition & 1 deletion docs/search-core.featuredsnippetdirectanswer.value.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The result of the direct answer.
<b>Signature:</b>

```typescript
value?: string;
value?: T;
```

## Remarks
Expand Down
2 changes: 1 addition & 1 deletion docs/search-core.fieldvaluedirectanswer.fieldtype.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ The field type of the direct answer.
<b>Signature:</b>

```typescript
fieldType: string;
fieldType: BuiltInFieldType | string;
```
8 changes: 4 additions & 4 deletions docs/search-core.fieldvaluedirectanswer.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ A direct answer where the answer came from a field from the knowledge graph.
<b>Signature:</b>

```typescript
export interface FieldValueDirectAnswer extends DirectAnswer
export interface FieldValueDirectAnswer<T = unknown> extends DirectAnswer<T>
```
<b>Extends:</b> [DirectAnswer](./search-core.directanswer.md)
<b>Extends:</b> [DirectAnswer](./search-core.directanswer.md)<!-- -->&lt;T&gt;
## Properties
Expand All @@ -20,9 +20,9 @@ export interface FieldValueDirectAnswer extends DirectAnswer
| [entityName](./search-core.fieldvaluedirectanswer.entityname.md) | string | The name of the entity that direct answer came from. |
| [fieldApiName](./search-core.fieldvaluedirectanswer.fieldapiname.md) | string | The field api name of the direct answer. |
| [fieldName](./search-core.fieldvaluedirectanswer.fieldname.md) | string | The field name of the direct answer. |
| [fieldType](./search-core.fieldvaluedirectanswer.fieldtype.md) | string | The field type of the direct answer. |
| [fieldType](./search-core.fieldvaluedirectanswer.fieldtype.md) | [BuiltInFieldType](./search-core.builtinfieldtype.md) \| string | The field type of the direct answer. |
| [relatedResult](./search-core.fieldvaluedirectanswer.relatedresult.md) | [Result](./search-core.result.md) | The entity associated with the direct answer. |
| [type](./search-core.fieldvaluedirectanswer.type.md) | [DirectAnswerType.FieldValue](./search-core.directanswertype.md) | [DirectAnswerType](./search-core.directanswertype.md)<!-- -->.FieldValue. |
| [value](./search-core.fieldvaluedirectanswer.value.md) | string | The result of the direct answer. |
| [value](./search-core.fieldvaluedirectanswer.value.md) | T | The result of the direct answer. |
| [verticalKey](./search-core.fieldvaluedirectanswer.verticalkey.md) | string | The vertical key of the direct answer. |
2 changes: 1 addition & 1 deletion docs/search-core.fieldvaluedirectanswer.value.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The result of the direct answer.
<b>Signature:</b>

```typescript
value: string;
value: T;
```

## Remarks
Expand Down
1 change: 1 addition & 0 deletions docs/search-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
| Enumeration | Description |
| --- | --- |
| [AppliedQueryFilterType](./search-core.appliedqueryfiltertype.md) | Represents the type of [AppliedQueryFilter](./search-core.appliedqueryfilter.md) applied to a search. |
| [BuiltInFieldType](./search-core.builtinfieldtype.md) | Possible built-in field types for [DirectAnswer.fieldType](./search-core.directanswer.fieldtype.md)<!-- -->. |
| [DirectAnswerType](./search-core.directanswertype.md) | Represents the type of direct answer. |
| [Direction](./search-core.direction.md) | The direction of a sort. |
| [ErrorType](./search-core.errortype.md) | Identifier for the type of error causing the failure. |
Expand Down
24 changes: 15 additions & 9 deletions etc/search-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ export interface BaseSearchConfig {
visitor?: Visitor;
}

// @public
export enum BuiltInFieldType {
// (undocumented)
Address = "address"
}

// @public
export interface ClientSDKHeaderValues {
[agent: string]: string | undefined;
Expand All @@ -103,11 +109,11 @@ export interface ClientSDKHeaderValues {
export type Context = any;

// @public
export interface DirectAnswer {
fieldType: string;
export interface DirectAnswer<T = unknown> {
fieldType: BuiltInFieldType | string;
relatedResult: Result;
type: DirectAnswerType;
value?: string;
value?: T;
verticalKey: string;
}

Expand Down Expand Up @@ -185,24 +191,24 @@ export interface FailedVertical {
}

// @public
export interface FeaturedSnippetDirectAnswer extends DirectAnswer {
fieldType: string;
export interface FeaturedSnippetDirectAnswer<T = unknown> extends DirectAnswer<T> {
fieldType: BuiltInFieldType | string;
relatedResult: Result;
snippet: Snippet;
type: DirectAnswerType.FeaturedSnippet;
value?: string;
value?: T;
verticalKey: string;
}

// @public
export interface FieldValueDirectAnswer extends DirectAnswer {
export interface FieldValueDirectAnswer<T = unknown> extends DirectAnswer<T> {
entityName: string;
fieldApiName: string;
fieldName: string;
fieldType: string;
fieldType: BuiltInFieldType | string;
relatedResult: Result;
type: DirectAnswerType.FieldValue;
value: string;
value: T;
verticalKey: string;
}

Expand Down
1 change: 1 addition & 0 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ 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 { BuiltInFieldType } from './searchservice/response/BuiltInFieldType';

// Search service common models
export { Matcher } from './searchservice/common/Matcher';
Expand Down
21 changes: 21 additions & 0 deletions src/models/searchservice/response/BuiltInFieldType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Possible built-in field types for {@link DirectAnswer.fieldType}.
* @public
*/
export enum BuiltInFieldType {
// URL = 'url',
// ComplexURL = 'complex_url',
// IOSAppURL = 'ios_app_url',
// AndroidAppURL = 'android_app_url',
// FacebookURL = 'facebook_url',
// Email = 'email',
// InstagramHandle = 'instagram_handle',
// TwitterHandle = 'twitter_handle',
// Phone = 'phone',
Address = 'address',
// Hours = 'hours',
// Decimal = 'decimal',
// RichText = 'rich_text',
// SingleLineText = 'single_line_text',
// MultiLineText = 'multi_line_text'
}
7 changes: 4 additions & 3 deletions src/models/searchservice/response/DirectAnswer.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Result } from './Result';
import { DirectAnswerType } from './DirectAnswerType';
import { BuiltInFieldType } from './BuiltInFieldType';

/**
* A direct answer to a search.
*
* @public
*/
export interface DirectAnswer {
export interface DirectAnswer<T = unknown> {
/** The {@link DirectAnswerType}. */
type: DirectAnswerType,
/**
Expand All @@ -15,11 +16,11 @@ export interface DirectAnswer {
* @remarks
* A value will not be present if the {@link DirectAnswer.fieldType} is 'rich_text'.
*/
value?: string,
value?: T,
/** The entity associated with the direct answer. */
relatedResult: Result,
/** The vertical key of the direct answer. */
verticalKey: string,
/** The field type of the direct answer. */
fieldType: string
fieldType: BuiltInFieldType | string
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DirectAnswer } from './DirectAnswer';
import { DirectAnswerType } from './DirectAnswerType';
import { BuiltInFieldType } from './BuiltInFieldType';
import { Result } from './Result';
import { Snippet } from './Snippet';

Expand All @@ -8,17 +9,17 @@ import { Snippet } from './Snippet';
*
* @public
*/
export interface FeaturedSnippetDirectAnswer extends DirectAnswer {
export interface FeaturedSnippetDirectAnswer<T = unknown> extends DirectAnswer<T> {
/** {@link DirectAnswerType}.FeaturedSnippet. */
type: DirectAnswerType.FeaturedSnippet,
/** {@inheritDoc DirectAnswer.value} */
value?: string,
value?: T,
/** {@inheritDoc DirectAnswer.relatedResult} */
relatedResult: Result,
/** {@inheritDoc DirectAnswer.verticalKey} */
verticalKey: string,
/** {@inheritDoc DirectAnswer.fieldType} */
fieldType: string,
fieldType: BuiltInFieldType | string,
/** The snippet where the direct answer was found. */
snippet: Snippet
}
7 changes: 4 additions & 3 deletions src/models/searchservice/response/FieldValueDirectAnswer.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { DirectAnswer } from './DirectAnswer';
import { DirectAnswerType } from './DirectAnswerType';
import { BuiltInFieldType } from './BuiltInFieldType';
import { Result } from './Result';

/**
* A direct answer where the answer came from a field from the knowledge graph.
*
* @public
*/
export interface FieldValueDirectAnswer extends DirectAnswer {
export interface FieldValueDirectAnswer<T = unknown> extends DirectAnswer<T> {
/** {@link DirectAnswerType}.FieldValue. */
type: DirectAnswerType.FieldValue,
/** {@inheritDoc DirectAnswer.value} */
value: string,
value: T,
/** {@inheritDoc DirectAnswer.relatedResult} */
relatedResult: Result,
/** {@inheritDoc DirectAnswer.verticalKey} */
verticalKey: string,
/** {@inheritDoc DirectAnswer.fieldType} */
fieldType: string,
fieldType: BuiltInFieldType | string,
/** The name of the entity that direct answer came from. */
entityName: string,
/** The field name of the direct answer. */
Expand Down

0 comments on commit 04ffcb9

Please sign in to comment.