UNPKG

11.1 kBTypeScriptView Raw
1/**
2 * Specifies how the individual match terms should be logically concatenated.
3 *
4 * @experimental This API is subject to change without notice.
5 * @category Full Text Search
6 */
7export declare enum MatchOperator {
8 /**
9 * Specifies that individual match terms are concatenated with a logical OR - this is the default if not provided.
10 */
11 Or = "or",
12 /**
13 * Specifies that individual match terms are concatenated with a logical AND.
14 */
15 And = "and"
16}
17/**
18 * GeoPoint represents a specific coordinate on earth. We support
19 * a number of different variants of geopoints being specified.
20 *
21 * @category Full Text Search
22 */
23export type GeoPoint = [longitude: number, latitude: number] | {
24 lon: number;
25 lat: number;
26} | {
27 longitude: number;
28 latitude: number;
29};
30/**
31 * Provides the ability to specify the query for a search query.
32 *
33 * @category Full Text Search
34 */
35export declare class SearchQuery {
36 protected _data: any;
37 constructor(data: any);
38 toJSON(): any;
39 /**
40 * @internal
41 */
42 static toJSON(query: SearchQuery | any): any;
43 /**
44 * @internal
45 */
46 static hasProp(query: SearchQuery | any, prop: string): boolean;
47 static match(match: string): MatchSearchQuery;
48 static matchPhrase(phrase: string): MatchPhraseSearchQuery;
49 static regexp(regexp: string): RegexpSearchQuery;
50 static queryString(query: string): QueryStringSearchQuery;
51 static numericRange(): NumericRangeSearchQuery;
52 static dateRange(): DateRangeSearchQuery;
53 /**
54 * Creates a ConjunctionSearchQuery from a set of other SearchQuery's.
55 *
56 * @deprecated Use the multi-argument overload instead.
57 */
58 static conjuncts(queries: SearchQuery[]): ConjunctionSearchQuery;
59 /**
60 * Creates a ConjunctionSearchQuery from a set of other SearchQuery's.
61 */
62 static conjuncts(...queries: SearchQuery[]): ConjunctionSearchQuery;
63 /**
64 * Creates a DisjunctionSearchQuery from a set of other SearchQuery's.
65 *
66 * @deprecated Use the multi-argument overload instead.
67 */
68 static disjuncts(queries: SearchQuery[]): DisjunctionSearchQuery;
69 /**
70 * Creates a DisjunctionSearchQuery from a set of other SearchQuery's.
71 */
72 static disjuncts(...queries: SearchQuery[]): DisjunctionSearchQuery;
73 static boolean(): BooleanSearchQuery;
74 static wildcard(wildcard: string): WildcardSearchQuery;
75 /**
76 * Creates a DocIdSearchQuery from a set of document-ids.
77 *
78 * @deprecated Use the multi-argument overload instead.
79 */
80 static docIds(queries: string[]): DocIdSearchQuery;
81 /**
82 * Creates a DocIdSearchQuery from a set of document-ids.
83 */
84 static docIds(...queries: string[]): DocIdSearchQuery;
85 static booleanField(val: boolean): BooleanFieldSearchQuery;
86 static term(term: string): TermSearchQuery;
87 static phrase(terms: string[]): PhraseSearchQuery;
88 static prefix(prefix: string): PrefixSearchQuery;
89 static matchAll(): MatchAllSearchQuery;
90 static matchNone(): MatchNoneSearchQuery;
91 static geoDistance(lon: number, lat: number, distance: number): GeoDistanceSearchQuery;
92 static geoBoundingBox(tl_lon: number, tl_lat: number, br_lon: number, br_lat: number): GeoBoundingBoxSearchQuery;
93 static geoPolygon(points: GeoPoint[]): GeoPolygonSearchQuery;
94}
95/**
96 * Represents a match search query.
97 *
98 * @category Full Text Search
99 */
100export declare class MatchSearchQuery extends SearchQuery {
101 /**
102 * @internal
103 */
104 constructor(match: string);
105 operator(op: MatchOperator): MatchSearchQuery;
106 field(field: string): MatchSearchQuery;
107 analyzer(analyzer: string): MatchSearchQuery;
108 prefixLength(prefixLength: number): MatchSearchQuery;
109 fuzziness(fuzziness: number): MatchSearchQuery;
110 boost(boost: number): MatchSearchQuery;
111}
112/**
113 * Represents a match-phrase search query.
114 *
115 * @category Full Text Search
116 */
117export declare class MatchPhraseSearchQuery extends SearchQuery {
118 /**
119 * @internal
120 */
121 constructor(phrase: string);
122 field(field: string): MatchPhraseSearchQuery;
123 analyzer(analyzer: string): MatchPhraseSearchQuery;
124 boost(boost: number): MatchPhraseSearchQuery;
125}
126/**
127 * Represents a regexp search query.
128 *
129 * @category Full Text Search
130 */
131export declare class RegexpSearchQuery extends SearchQuery {
132 /**
133 * @internal
134 */
135 constructor(regexp: string);
136 field(field: string): RegexpSearchQuery;
137 boost(boost: number): RegexpSearchQuery;
138}
139/**
140 * Represents a query-string search query.
141 *
142 * @category Full Text Search
143 */
144export declare class QueryStringSearchQuery extends SearchQuery {
145 /**
146 * @internal
147 */
148 constructor(query: string);
149 boost(boost: number): QueryStringSearchQuery;
150}
151/**
152 * Represents a numeric-range search query.
153 *
154 * @category Full Text Search
155 */
156export declare class NumericRangeSearchQuery extends SearchQuery {
157 /**
158 * @internal
159 */
160 constructor();
161 min(min: number, inclusive?: boolean): NumericRangeSearchQuery;
162 max(max: number, inclusive?: boolean): NumericRangeSearchQuery;
163 field(field: string): NumericRangeSearchQuery;
164 boost(boost: number): NumericRangeSearchQuery;
165}
166/**
167 * Represents a date-range search query.
168 *
169 * @category Full Text Search
170 */
171export declare class DateRangeSearchQuery extends SearchQuery {
172 /**
173 * @internal
174 */
175 constructor();
176 start(start: Date | string, inclusive?: boolean): DateRangeSearchQuery;
177 end(end: Date | string, inclusive?: boolean): DateRangeSearchQuery;
178 field(field: string): DateRangeSearchQuery;
179 dateTimeParser(parser: string): DateRangeSearchQuery;
180 boost(boost: number): DateRangeSearchQuery;
181}
182/**
183 * Represents a conjunction search query.
184 *
185 * @category Full Text Search
186 */
187export declare class ConjunctionSearchQuery extends SearchQuery {
188 /**
189 * @internal
190 */
191 constructor(...queries: SearchQuery[]);
192 /**
193 * Adds additional queries to this conjunction query.
194 *
195 * @deprecated Use the multi-argument overload instead.
196 */
197 and(queries: SearchQuery[]): ConjunctionSearchQuery;
198 /**
199 * Adds additional queries to this conjunction query.
200 */
201 and(...queries: SearchQuery[]): ConjunctionSearchQuery;
202 boost(boost: number): ConjunctionSearchQuery;
203}
204/**
205 * Represents a disjunction search query.
206 *
207 * @category Full Text Search
208 */
209export declare class DisjunctionSearchQuery extends SearchQuery {
210 /**
211 * @internal
212 */
213 constructor(...queries: SearchQuery[]);
214 /**
215 * Adds additional queries to this disjunction query.
216 *
217 * @deprecated Use the multi-argument overload instead.
218 */
219 or(queries: SearchQuery[]): DisjunctionSearchQuery;
220 /**
221 * Adds additional queries to this disjunction query.
222 */
223 or(...queries: SearchQuery[]): DisjunctionSearchQuery;
224 boost(boost: number): DisjunctionSearchQuery;
225}
226/**
227 * Represents a boolean search query.
228 *
229 * @category Full Text Search
230 */
231export declare class BooleanSearchQuery extends SearchQuery {
232 private _shouldMin;
233 /**
234 * @internal
235 */
236 constructor();
237 must(query: ConjunctionSearchQuery): BooleanSearchQuery;
238 should(query: DisjunctionSearchQuery): BooleanSearchQuery;
239 mustNot(query: DisjunctionSearchQuery): BooleanSearchQuery;
240 shouldMin(shouldMin: number): BooleanSearchQuery;
241 boost(boost: number): BooleanSearchQuery;
242 toJSON(): any;
243}
244/**
245 * Represents a wildcard search query.
246 *
247 * @category Full Text Search
248 */
249export declare class WildcardSearchQuery extends SearchQuery {
250 /**
251 * @internal
252 */
253 constructor(wildcard: string);
254 field(field: string): WildcardSearchQuery;
255 boost(boost: number): WildcardSearchQuery;
256}
257/**
258 * Represents a document-id search query.
259 *
260 * @category Full Text Search
261 */
262export declare class DocIdSearchQuery extends SearchQuery {
263 /**
264 * @internal
265 */
266 constructor(...ids: string[]);
267 /**
268 * Adds additional document-id's to this query.
269 *
270 * @deprecated Use the multi-argument overload instead.
271 */
272 addDocIds(ids: string[]): DocIdSearchQuery;
273 /**
274 * Adds additional document-id's to this query.
275 */
276 addDocIds(...ids: string[]): DocIdSearchQuery;
277 field(field: string): DocIdSearchQuery;
278 boost(boost: number): DocIdSearchQuery;
279}
280/**
281 * Represents a boolean-field search query.
282 *
283 * @category Full Text Search
284 */
285export declare class BooleanFieldSearchQuery extends SearchQuery {
286 /**
287 * @internal
288 */
289 constructor(val: boolean);
290 field(field: string): BooleanFieldSearchQuery;
291 boost(boost: number): BooleanFieldSearchQuery;
292}
293/**
294 * Represents a term search query.
295 *
296 * @category Full Text Search
297 */
298export declare class TermSearchQuery extends SearchQuery {
299 /**
300 * @internal
301 */
302 constructor(term: string);
303 field(field: string): TermSearchQuery;
304 prefixLength(prefixLength: number): TermSearchQuery;
305 fuzziness(fuzziness: number): TermSearchQuery;
306 boost(boost: number): TermSearchQuery;
307}
308/**
309 * Represents a phrase search query.
310 *
311 * @category Full Text Search
312 */
313export declare class PhraseSearchQuery extends SearchQuery {
314 /**
315 * @internal
316 */
317 constructor(terms: string[]);
318 field(field: string): PhraseSearchQuery;
319 boost(boost: number): PhraseSearchQuery;
320}
321/**
322 * Represents a prefix search query.
323 *
324 * @category Full Text Search
325 */
326export declare class PrefixSearchQuery extends SearchQuery {
327 /**
328 * @internal
329 */
330 constructor(prefix: string);
331 field(field: string): PrefixSearchQuery;
332 boost(boost: number): PrefixSearchQuery;
333}
334/**
335 * Represents a match-all search query.
336 *
337 * @category Full Text Search
338 */
339export declare class MatchAllSearchQuery extends SearchQuery {
340 /**
341 * @internal
342 */
343 constructor();
344}
345/**
346 * Represents a match-none search query.
347 *
348 * @category Full Text Search
349 */
350export declare class MatchNoneSearchQuery extends SearchQuery {
351 /**
352 * @internal
353 */
354 constructor();
355}
356/**
357 * Represents a geo-distance search query.
358 *
359 * @category Full Text Search
360 */
361export declare class GeoDistanceSearchQuery extends SearchQuery {
362 /**
363 * @internal
364 */
365 constructor(lon: number, lat: number, distance: number);
366 field(field: string): GeoDistanceSearchQuery;
367 boost(boost: number): GeoDistanceSearchQuery;
368}
369/**
370 * Represents a geo-bounding-box search query.
371 *
372 * @category Full Text Search
373 */
374export declare class GeoBoundingBoxSearchQuery extends SearchQuery {
375 /**
376 * @internal
377 */
378 constructor(tl_lon: number, tl_lat: number, br_lon: number, br_lat: number);
379 field(field: string): GeoBoundingBoxSearchQuery;
380 boost(boost: number): GeoBoundingBoxSearchQuery;
381}
382/**
383 * Represents a geo-polygon search query.
384 *
385 * @category Full Text Search
386 */
387export declare class GeoPolygonSearchQuery extends SearchQuery {
388 /**
389 * @internal
390 */
391 constructor(points: GeoPoint[]);
392 field(field: string): GeoPolygonSearchQuery;
393 boost(boost: number): GeoPolygonSearchQuery;
394}