1 | import { MutationState } from './mutationstate';
|
2 | import { SearchFacet } from './searchfacet';
|
3 | import { SearchQuery } from './searchquery';
|
4 | import { SearchSort } from './searchsort';
|
5 | import { VectorSearch } from './vectorsearch';
|
6 | /**
|
7 | * SearchMetaData represents the meta-data available from a search query.
|
8 | * This class is currently incomplete and must be casted to `any` in
|
9 | * TypeScript to be used.
|
10 | *
|
11 | * @category Full Text Search
|
12 | */
|
13 | export declare class SearchMetaData {
|
14 | }
|
15 | /**
|
16 | * SearchRow represents the data available from a row of a search query.
|
17 | * This class is currently incomplete and must be casted to `any` in
|
18 | * TypeScript to be used.
|
19 | *
|
20 | * @category Full Text Search
|
21 | */
|
22 | export declare class SearchRow {
|
23 | }
|
24 | /**
|
25 | * Contains the results of a search query.
|
26 | *
|
27 | * @category Full Text Search
|
28 | */
|
29 | export declare class SearchResult {
|
30 | /**
|
31 | * The rows which have been returned by the query.
|
32 | */
|
33 | rows: any[];
|
34 | /**
|
35 | * The meta-data which has been returned by the query.
|
36 | */
|
37 | meta: SearchMetaData;
|
38 | /**
|
39 | * @internal
|
40 | */
|
41 | constructor(data: SearchResult);
|
42 | }
|
43 | /**
|
44 | * Specifies the highlight style that should be used for matches in the results.
|
45 | *
|
46 | * @category Full Text Search
|
47 | */
|
48 | export declare enum HighlightStyle {
|
49 | /**
|
50 | * Indicates that matches should be highlighted using HTML tags in the result text.
|
51 | */
|
52 | HTML = "html",
|
53 | /**
|
54 | * Indicates that matches should be highlighted using ASCII coding in the result test.
|
55 | */
|
56 | ANSI = "ansi"
|
57 | }
|
58 | /**
|
59 | * Represents the various scan consistency options that are available when
|
60 | * querying against the query service.
|
61 | *
|
62 | * @category Full Text Search
|
63 | */
|
64 | export declare enum SearchScanConsistency {
|
65 | /**
|
66 | * Indicates that no specific consistency is required, this is the fastest
|
67 | * options, but results may not include the most recent operations which have
|
68 | * been performed.
|
69 | */
|
70 | NotBounded = "not_bounded"
|
71 | }
|
72 | /**
|
73 | * @category Full Text Search
|
74 | */
|
75 | export interface SearchQueryOptions {
|
76 | /**
|
77 | * Specifies the number of results to skip from the index before returning
|
78 | * results.
|
79 | */
|
80 | skip?: number;
|
81 | /**
|
82 | * Specifies the limit to the number of results that should be returned.
|
83 | */
|
84 | limit?: number;
|
85 | /**
|
86 | * Configures whether the result should contain the execution plan for the query.
|
87 | */
|
88 | explain?: boolean;
|
89 | /**
|
90 | * Specifies how the highlighting should behave. Specifically which mode should be
|
91 | * used for highlighting as well as which fields should be highlighted.
|
92 | */
|
93 | highlight?: {
|
94 | style?: HighlightStyle;
|
95 | fields?: string[];
|
96 | };
|
97 | /**
|
98 | * Specifies the collections which should be searched as part of the query.
|
99 | */
|
100 | collections?: string[];
|
101 | /**
|
102 | * Specifies the list of fields which should be searched.
|
103 | */
|
104 | fields?: string[];
|
105 | /**
|
106 | * Specifies any facets that should be included in the query.
|
107 | */
|
108 | facets?: {
|
109 | [name: string]: SearchFacet;
|
110 | };
|
111 | /**
|
112 | * Specifies a list of fields or SearchSort's to use when sorting the result sets.
|
113 | */
|
114 | sort?: string[] | SearchSort[];
|
115 | /**
|
116 | * Specifies that scoring should be disabled. This improves performance but makes it
|
117 | * impossible to sort based on how well a particular result scored.
|
118 | */
|
119 | disableScoring?: boolean;
|
120 | /**
|
121 | * If set to true, will include the locations in the search result.
|
122 | *
|
123 | * @experimental This API is subject to change without notice.
|
124 | */
|
125 | includeLocations?: boolean;
|
126 | /**
|
127 | * Specifies the consistency requirements when executing the query.
|
128 | *
|
129 | * @see SearchScanConsistency
|
130 | */
|
131 | consistency?: SearchScanConsistency;
|
132 | /**
|
133 | * Specifies a MutationState which the query should be consistent with.
|
134 | *
|
135 | * @see {@link MutationState}
|
136 | */
|
137 | consistentWith?: MutationState;
|
138 | /**
|
139 | * Specifies any additional parameters which should be passed to the query engine
|
140 | * when executing the query.
|
141 | */
|
142 | raw?: {
|
143 | [key: string]: any;
|
144 | };
|
145 | /**
|
146 | * The timeout for this operation, represented in milliseconds.
|
147 | */
|
148 | timeout?: number;
|
149 | /**
|
150 | * Specifies that the search response should include the request JSON.
|
151 | */
|
152 | showRequest?: boolean;
|
153 | /**
|
154 | * Uncommitted: This API is subject to change in the future.
|
155 | * Specifies that the search request should appear in the log.
|
156 | */
|
157 | logRequest?: boolean;
|
158 | /**
|
159 | * Uncommitted: This API is subject to change in the future.
|
160 | * Specifies that the search response should appear in the log.
|
161 | */
|
162 | logResponse?: boolean;
|
163 | }
|
164 | /**
|
165 | * Represents a search query and/or vector search to execute via the Couchbase Full Text Search (FTS) service.
|
166 | *
|
167 | * @category Full Text Search
|
168 | */
|
169 | export declare class SearchRequest {
|
170 | private _searchQuery;
|
171 | private _vectorSearch;
|
172 | constructor(query: SearchQuery | VectorSearch);
|
173 | /**
|
174 | * @internal
|
175 | */
|
176 | get searchQuery(): SearchQuery | undefined;
|
177 | /**
|
178 | * @internal
|
179 | */
|
180 | get vectorSearch(): VectorSearch | undefined;
|
181 | /**
|
182 | * Adds a search query to the request if the request does not already have a search query.
|
183 | *
|
184 | * @param query A SearchQuery to add to the request.
|
185 | */
|
186 | withSearchQuery(query: SearchQuery): SearchRequest;
|
187 | /**
|
188 | * Adds a vector search to the request if the request does not already have a vector search.
|
189 | *
|
190 | * @param search A VectorSearch to add to the request.
|
191 | */
|
192 | withVectorSearch(search: VectorSearch): SearchRequest;
|
193 | /**
|
194 | * Creates a search request.
|
195 | *
|
196 | * @param query Either a SearchQuery or VectorSearch to add to the search request.
|
197 | */
|
198 | static create(query: SearchQuery | VectorSearch): SearchRequest;
|
199 | }
|