UNPKG

3.25 kBTypeScriptView Raw
1import { _SPInstance, ISPQueryable } from "../spqueryable.js";
2export declare class _Suggest extends _SPInstance {
3 run(query: ISuggestQuery): Promise<ISuggestResult>;
4 private mapQueryToQueryString;
5}
6export interface ISuggest {
7 (query: ISuggestQuery): Promise<ISuggestResult>;
8}
9export declare const Suggest: (baseUrl: string | ISPQueryable) => ISuggest;
10/**
11 * Defines a query execute against the search/suggest endpoint (see https://msdn.microsoft.com/en-us/library/office/dn194079.aspx)
12 */
13export interface ISuggestQuery {
14 /**
15 * A string that contains the text for the search query.
16 */
17 querytext: string;
18 /**
19 * The number of query suggestions to retrieve. Must be greater than zero (0). The default value is 5.
20 */
21 count?: number;
22 /**
23 * The number of personal results to retrieve. Must be greater than zero (0). The default value is 5.
24 */
25 personalCount?: number;
26 /**
27 * A Boolean value that specifies whether to retrieve pre-query or post-query suggestions. true to return pre-query suggestions; otherwise, false. The default value is false.
28 */
29 preQuery?: boolean;
30 /**
31 * A Boolean value that specifies whether to hit-highlight or format in bold the query suggestions. true to format in bold the terms in the returned query suggestions
32 * that match terms in the specified query; otherwise, false. The default value is true.
33 */
34 hitHighlighting?: boolean;
35 /**
36 * A Boolean value that specifies whether to capitalize the first letter in each term in the returned query suggestions. true to capitalize the first letter in each term;
37 * otherwise, false. The default value is false.
38 */
39 capitalize?: boolean;
40 /**
41 * The locale ID (LCID) for the query (see https://msdn.microsoft.com/en-us/library/cc233982.aspx).
42 */
43 culture?: string;
44 /**
45 * A Boolean value that specifies whether stemming is enabled. true to enable stemming; otherwise, false. The default value is true.
46 */
47 stemming?: boolean;
48 /**
49 * A Boolean value that specifies whether to include people names in the returned query suggestions. true to include people names in the returned query suggestions;
50 * otherwise, false. The default value is true.
51 */
52 includePeople?: boolean;
53 /**
54 * A Boolean value that specifies whether to turn on query rules for this query. true to turn on query rules; otherwise, false. The default value is true.
55 */
56 queryRules?: boolean;
57 /**
58 * A Boolean value that specifies whether to return query suggestions for prefix matches. true to return query suggestions based on prefix matches, otherwise, false when
59 * query suggestions should match the full query word.
60 */
61 prefixMatch?: boolean;
62 [key: string]: string | number | boolean;
63}
64export interface ISuggestResult {
65 readonly PeopleNames: string[];
66 readonly PersonalResults: IPersonalResultSuggestion[];
67 readonly Queries: any[];
68}
69export interface IPersonalResultSuggestion {
70 readonly HighlightedTitle?: string;
71 readonly IsBestBet?: boolean;
72 readonly Title?: string;
73 readonly TypeId?: string;
74 readonly Url?: string;
75}
76//# sourceMappingURL=suggest.d.ts.map
\No newline at end of file