Skip to content

Commit f8f6fa8

Browse files
adding query for a search api v2; refactoring request code
1 parent 1a2db9e commit f8f6fa8

29 files changed

+1529
-1292
lines changed

.github/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ Property Name | Type | Operation(s) Supported | Description
347347
action | `Object` | `callAction` | A JavaScript object that represents a Dynamics 365 Web API action.
348348
actionName | `string` | `callAction` | Web API Action name.
349349
addAnnotations | `boolean` | `retrieveCsdlMetadata` | If set to `true` the document will include many different kinds of annotations that can be useful. Most annotations are not included by default because they increase the total size of the document.
350-
apply | `string` | `retrieveMultiple`, `retrieveAll` | Sets the $apply system query option to aggregate and group your data dynamically. [More Info](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/query-data-web-api#aggregate-and-grouping-results)
350+
apply | `string` | `retrieveMultiple`, `retrieveAll` | Sets the $apply system query option to aggregate and group your data dynamically. [More Info](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query/aggregate-data)
351351
async | `boolean` | All | **XHR requests only!** Indicates whether the requests should be made synchronously or asynchronously. Default value is `true` (asynchronously).
352352
bypassCustomPluginExecution | `boolean` | `create`, `update`, `upsert`, `delete` | If set to true, the request bypasses custom business logic, all synchronous plug-ins and real-time workflows are disabled. Check for special exceptions in Microsft Docs. [More Info](https://docs.microsoft.com/en-us/powerapps/developer/data-platform/bypass-custom-business-logic)
353353
collection | `string` | All | Entity Collection name.

dist/browser/esm/dynamics-web-api.js

Lines changed: 194 additions & 162 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser/esm/dynamics-web-api.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/dynamics-web-api.js

Lines changed: 193 additions & 162 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/dynamics-web-api.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dynamics-web-api.d.ts

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -797,30 +797,66 @@ export interface CsdlMetadataRequest extends BaseRequest {
797797
}
798798
export type SearchMode = "any" | "all";
799799
export type SearchType = "simple" | "full";
800+
export type SearchEntity = {
801+
/**Logical name of the table. Specifies scope of the query. */
802+
name: string;
803+
/**List of columns that needs to be projected when table documents are returned in response. If empty, only the table primary name is returned. */
804+
selectColumns?: string[];
805+
/**List of columns to scope the query on. If empty, only the table primary name is searched on.*/
806+
searchColumns?: string[];
807+
/**Filters applied on the entity.*/
808+
filter?: string;
809+
};
810+
export type SearchOptions = {
811+
/**Values can be simple or lucene. */
812+
querytype?: "simple" | "lucene";
813+
/**Enables intelligent query workflow to return probable set of results if no good matches are found for the search request terms.*/
814+
besteffortsearchenabled?: boolean;
815+
/**Enable ranking of results in the response optimized for display in search results pages where results are grouped by table.*/
816+
searchmode?: SearchMode;
817+
/**When specified as all the search terms must be matched in order to consider the document as a match. Setting its value to any defaults to matching any word in the search term.*/
818+
grouprankingenabled?: boolean;
819+
};
800820
export interface SearchQueryBase {
801821
/**The search parameter value contains the term to be searched for and has a 100-character limit. For suggestions, min 3 characters in addition. */
802822
search: string;
803823
/**The default table list searches across all Dataverse search–configured tables and columns. The default list is configured by your administrator when Dataverse search is enabled. */
804-
entities?: string[];
824+
entities?: string[] | SearchEntity[];
805825
/**Filters are applied while searching data and are specified in standard OData syntax. */
806826
filter?: string;
807827
}
808-
export interface Search extends SearchQueryBase {
828+
export interface Query extends SearchQueryBase {
829+
/**V2. Whether to return the total record count.*/
830+
count?: boolean;
809831
/**Facets support the ability to drill down into data results after they've been retrieved. */
810832
facets?: string[];
811-
/**Specify true to return the total record count; otherwise false. The default is false. */
833+
/**
834+
* Specify true to return the total record count; otherwise false. The default is false.
835+
* @deprecated Use "count".
836+
*/
812837
returnTotalRecordCount?: boolean;
813838
/**Specifies the number of search results to skip. */
814839
skip?: number;
815840
/**Specifies the number of search results to retrieve. The default is 50, and the maximum value is 100. */
816841
top?: number;
817842
/**A list of comma-separated clauses where each clause consists of a column name followed by 'asc' (ascending, which is the default) or 'desc' (descending). This list specifies how to order the results in order of precedence. */
818843
orderBy?: string[];
819-
/**Specifies whether any or all the search terms must be matched to count the document as a match. The default is 'any'. */
844+
/**V2. Options are settings configured to search a search term. */
845+
options?: SearchOptions[];
846+
/**
847+
* Specifies whether any or all the search terms must be matched to count the document as a match. The default is 'any'.
848+
* @deprecated Use "options.searchmode".
849+
*/
820850
searchMode?: SearchMode;
821-
/**The search type specifies the syntax of a search query. Using 'simple' selects simple query syntax and 'full' selects Lucene query syntax. The default is 'simple'. */
851+
/**
852+
* For V2, use "options.querytype". The search type specifies the syntax of a search query. Using 'simple' selects simple query syntax and 'full' selects Lucene query syntax. The default is 'simple'.
853+
* @deprecated Use "options.querytype".
854+
*/
822855
searchType?: SearchType;
823856
}
857+
/**@deprecated Use Query instead */
858+
export interface Search extends Query {
859+
}
824860
export interface Suggest extends SearchQueryBase {
825861
/**Use fuzzy search to aid with misspellings. The default is false. */
826862
useFuzzy?: boolean;
@@ -833,9 +869,12 @@ export interface Autocomplete extends SearchQueryBase {
833869
/**Use fuzzy search to aid with misspellings. The default is false. */
834870
useFuzzy?: boolean;
835871
}
836-
export interface SearchRequest extends BaseRequest {
872+
export interface QueryRequest extends BaseRequest {
837873
/**Search query object */
838-
query: Search;
874+
query: Query;
875+
}
876+
/**@deprecated Use QueryRequest instead. */
877+
export interface SearchRequest extends QueryRequest {
839878
}
840879
export interface SuggestRequest extends BaseRequest {
841880
/**Suggestion query object */
@@ -1053,7 +1092,7 @@ type SearchFunction = {
10531092
* @param request - An object that represents all possible options for a current request.
10541093
* @returns {Promise<SearchResponse<TValue>>} Search result
10551094
*/
1056-
<TValue = any>(request: SearchRequest): Promise<SearchResponse<TValue>>;
1095+
<TValue = any>(request: QueryRequest): Promise<SearchResponse<TValue>>;
10571096
};
10581097
type SuggestFunction = {
10591098
/**

0 commit comments

Comments
 (0)