Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/search-core.verticalsearchrequest.facetallowlist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-core](./search-core.md) &gt; [VerticalSearchRequest](./search-core.verticalsearchrequest.md) &gt; [facetAllowlist](./search-core.verticalsearchrequest.facetallowlist.md)

## VerticalSearchRequest.facetAllowlist property

A subset of facet field IDs that facet options will be retrieved for.

**Signature:**

```typescript
facetAllowlist?: string[];
```
19 changes: 19 additions & 0 deletions docs/search-core.verticalsearchrequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,25 @@ Description
_(Optional)_ Used to trigger Search [Query Rules](https://hitchhikers.yext.com/tracks/answers-advanced/ans302-query-rules/)<!-- -->.


</td></tr>
<tr><td>

[facetAllowlist?](./search-core.verticalsearchrequest.facetallowlist.md)


</td><td>


</td><td>

string\[\]


</td><td>

_(Optional)_ A subset of facet field IDs that facet options will be retrieved for.


</td></tr>
<tr><td>

Expand Down
1 change: 1 addition & 0 deletions etc/search-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ export interface VerticalResults {
// @public
export interface VerticalSearchRequest extends SearchRequest {
context?: Context;
facetAllowlist?: string[];
facets?: Facet[];
limit?: number;
location?: LatLong;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yext/search-core",
"version": "2.6.3",
"version": "2.6.4",
"description": "Typescript Networking Library for the Yext Search API",
"main": "./dist/commonjs/src/index.js",
"module": "./dist/esm/src/index.js",
Expand Down
6 changes: 4 additions & 2 deletions src/infra/SearchServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ interface VerticalSearchQueryParams extends QueryParams {
source?: QuerySource | string,
locationRadius?: string,
queryId?: string,
visitor?: string
visitor?: string,
facetAllowlist?: string
}

/**
Expand Down Expand Up @@ -167,6 +168,7 @@ export class SearchServiceImpl implements SearchService {
queryId: request.queryId,
visitorId: this.config.visitor?.id,
visitorIdMethod: this.config.visitor?.idMethod,
facetAllowlist: request.facetAllowlist?.join(','),
...this.config?.additionalQueryParams
};

Expand Down Expand Up @@ -200,4 +202,4 @@ export class SearchServiceImpl implements SearchService {
}
return `${latLong.latitude},${latLong.longitude}`;
}
}
}
6 changes: 4 additions & 2 deletions src/models/searchservice/request/VerticalSearchRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ export interface VerticalSearchRequest extends SearchRequest {
/** The radius (in meters) to filter the vertical search by. */
locationRadius?: number,
/** The queryId for the query, if this is a repeat query. */
queryId?: string
}
queryId?: string,
/** A subset of facet field IDs that facet options will be retrieved for. */
facetAllowlist?: string[]
}
1 change: 1 addition & 0 deletions test-site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<button onclick="filterSearch()">Filter Search</button>
<button onclick="generativeDirectAnswer()">Generative Direct Answer</button>
<button onclick="functionVerticalSearch()">Function Vertical Search</button>
<button onclick="locationsVerticalSearch()">Locations Vertical Search</button>
</body>
</html>
9 changes: 8 additions & 1 deletion test-site/src/js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { provideCore } from '@yext/search-core';
import { verticalRequest, functionVerticalRequest } from './requests/verticalRequest';
import { verticalRequest, functionVerticalRequest, locationsVerticalRequest } from './requests/verticalRequest';
import universalRequest from './requests/universalRequest';
import questionRequest from './requests/questionRequest';
import { univeralAutocompleteRequest, verticalAutocompleteRequest, filterSearchRequest } from './requests/autocompleteRequests';
Expand Down Expand Up @@ -76,6 +76,13 @@ export async function functionVerticalSearch() {
updateUI(results, startTime, 'Core Function Vertical Response:');
}

export async function locationsVerticalSearch() {
loadingSpinner();
const startTime = new Date().getTime();
const results = await globalCore.verticalSearch(locationsVerticalRequest);
updateUI(results, startTime, 'Locations Vertical Response:');
}

function loadingSpinner() {
element.textContent = 'Loading...';
}
Expand Down
9 changes: 8 additions & 1 deletion test-site/src/js/requests/verticalRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ export const verticalRequest = {
referrerPageUrl: 'www.google.com/answers/not/ads'
};

export const locationsVerticalRequest = {
verticalKey: 'KM',
query: 'virginia',
retrieveFacets: true,
facetAllowlist: ['address.city', 'services']
};

export const functionVerticalRequest = {
verticalKey: 'function_vertical',
query: 'virginia',
};
};
13 changes: 12 additions & 1 deletion test-site/src/ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { provideCore, SearchConfig, SearchCore, UniversalSearchRequest, UniversalSearchResponse } from '@yext/search-core';
import { verticalRequest, functionVerticalRequest } from './requests/verticalRequest';
import {
verticalRequest,
functionVerticalRequest,
locationsVerticalRequest
} from './requests/verticalRequest';
import universalRequest from './requests/universalRequest';
import questionRequest from './requests/questionRequest';
import { univeralAutocompleteRequest, verticalAutocompleteRequest, filterSearchRequest } from './requests/autocompleteRequests';
Expand Down Expand Up @@ -51,6 +55,13 @@ export async function functionVerticalSearch(): Promise<void> {
updateUI(results, startTime, 'Core Function Vertical Response:');
}

export async function locationsVerticalSearch(): Promise<void> {
loadingSpinner();
const startTime = new Date().getTime();
const results = await globalCore.verticalSearch(locationsVerticalRequest);
updateUI(results, startTime, 'Locations Vertical Response:');
}

export async function submitQuestion(): Promise<void> {
loadingSpinner();
const startTime = new Date().getTime();
Expand Down
9 changes: 8 additions & 1 deletion test-site/src/ts/requests/verticalRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ export const verticalRequest: VerticalSearchRequest = {
}
};

export const locationsVerticalRequest: VerticalSearchRequest = {
verticalKey: 'KM',
query: 'virginia',
retrieveFacets: true,
facetAllowlist: ['address.city', 'services']
};

export const functionVerticalRequest: VerticalSearchRequest = {
verticalKey: 'function_vertical',
query: 'virginia',
};
};