Skip to content

Commit

Permalink
Merge pull request #3675 from lebiku/feature/graph-query-template
Browse files Browse the repository at this point in the history
Proper support of query template in Microsoft Search
  • Loading branch information
wobba authored Apr 11, 2024
2 parents 47ddd83 + 0c670ea commit f11e6d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
12 changes: 3 additions & 9 deletions search-parts/src/dataSources/MicrosoftSearchDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ export class MicrosoftSearchDataSource extends BaseDataSource<IMicrosoftSearchDa
if (this.properties.entityTypes.indexOf(EntityType.DriveItem) !== -1 ||
this.properties.entityTypes.indexOf(EntityType.ListItem) !== -1 ||
this.properties.entityTypes.indexOf(EntityType.Site) !== -1 ||
this.properties.entityTypes.indexOf(EntityType.List) !== -1 ||
this.properties.entityTypes.indexOf(EntityType.List) !== -1 ||
this.properties.entityTypes.indexOf(EntityType.ExternalItem) !== -1) {

sortPropertiesFields.push(
Expand Down Expand Up @@ -688,12 +688,6 @@ export class MicrosoftSearchDataSource extends BaseDataSource<IMicrosoftSearchDa

// Query modification
let queryTemplate = await this._tokenService.resolveTokens(this.properties.queryTemplate);
if (!isEmpty(queryTemplate.trim()) && !this.properties.useBetaEndpoint) {

// Use {searchTerms} or {inputQueryText} to use orginal value
// As of 06/06/2022 the query template is still in beta so we use the query text instead
queryText = queryTemplate.trim();
}

// Paging
if (dataContext.pageNumber > 1) {
Expand Down Expand Up @@ -778,8 +772,8 @@ export class MicrosoftSearchDataSource extends BaseDataSource<IMicrosoftSearchDa
}

// Sort is only available for 'ListItem' and ExternalItem
if (this.properties.entityTypes.indexOf(EntityType.ListItem) !== -1 ||
this.properties.entityTypes.indexOf(EntityType.ExternalItem) !== -1) {
if (this.properties.entityTypes.indexOf(EntityType.ListItem) !== -1 ||
this.properties.entityTypes.indexOf(EntityType.ExternalItem) !== -1) {

if (dataContext.sorting?.selectedSortFieldName
&& dataContext.sorting?.selectedSortDirection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2208,11 +2208,6 @@ export default class SearchResultsWebPart extends BaseWebPart<ISearchResultsWebP
this.tokenService.setTokenValue(BuiltinTokenNames.inputQueryText, inputQueryText);
this.tokenService.setTokenValue(BuiltinTokenNames.originalInputQueryText, inputQueryText);

//Set searchTerms value from inputQueryText, but set initial token value, undefined, if empty
const searchTerms = inputQueryText ?? undefined;
// Legacy token for SharePoint and Microsoft Search data sources
this.tokenService.setTokenValue(BuiltinTokenNames.searchTerms, searchTerms);

// Selected filters
if (this._filtersConnectionSourceData) {

Expand Down

0 comments on commit f11e6d6

Please sign in to comment.