Skip to content

Commit 42a9526

Browse files
committed
Changes from main
2 parents 1a34cfb + 2b45005 commit 42a9526

File tree

4 files changed

+83
-59
lines changed

4 files changed

+83
-59
lines changed

.code-samples.meilisearch.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,3 +415,28 @@ search_parameter_guide_sort_1: |-
415415
client.index('books').search('science fiction', {
416416
sort: ['price:asc'],
417417
})
418+
geosearch_guide_filter_settings_1: |-
419+
client.index('restaurants')
420+
.updateFilterableAttributes([
421+
'_geo'
422+
])
423+
geosearch_guide_filter_usage_1: |-
424+
client.index('restaurants').search('', {
425+
filter: ['_geoRadius(45.4628328, 9.1076931, 2000)'],
426+
})
427+
geosearch_guide_filter_usage_2: |-
428+
client.index('restaurants').search('', {
429+
filter: ['_geoRadius(45.4628328, 9.1076931, 2000) AND type = pizza'],
430+
})
431+
geosearch_guide_sort_settings_1: |-
432+
client.index('restaurants').updateSortableAttributes([
433+
'_geo'
434+
])
435+
geosearch_guide_sort_usage_1: |-
436+
client.index('restaurants').search('', {
437+
sort: ['_geoPoint(48.8583701,2.2922926):asc'],
438+
})
439+
geosearch_guide_sort_usage_2: |-
440+
client.index('restaurants').search('', {
441+
sort: ['_geoPoint(48.8583701,2.2922926):asc', 'rating:desc'],
442+
})

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,6 @@ cypress/fixtures
126126
dist
127127
package
128128
.vscode
129+
.idea
129130
dist_default_export_in_index
130131
no_default_export_in_index

README.md

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ await index.search(
271271
"Adventure": 1
272272
}
273273
}
274+
}
274275
```
275276

276277
#### Abortable Search <!-- omit in toc -->
@@ -296,7 +297,7 @@ controller.abort()
296297

297298
## 🤖 Compatibility with MeiliSearch
298299

299-
This package only guarantees the compatibility with the [version v0.22.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.22.0).
300+
This package only guarantees the compatibility with the [version v0.23.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.23.0).
300301

301302
## 💡 Learn More
302303

@@ -319,54 +320,52 @@ If you want to know more about the development workflow or want to contribute, p
319320

320321
### Search <!-- omit in toc -->
321322

322-
- Make a search request:
323+
- [Make a search request](https://docs.meilisearch.com/reference/api/search.html):
323324

324325
`client.index<T>('xxx').search(query: string, options: SearchParams = {}, config?: Partial<Request>): Promise<SearchResponse<T>>`
325326

326-
- Make a search request using the GET method (slower than the search method):
327+
- [Make a search request using the GET method (slower than the search method)](https://docs.meilisearch.com/reference/api/search.html#search-in-an-index-with-get-route):
327328

328329
`client.index<T>('xxx').searchGet(query: string, options: SearchParams = {}, config?: Partial<Request>): Promise<SearchResponse<T>>`
329330

330331
### Indexes <!-- omit in toc -->
331332

332-
- Get all indexes:
333+
- [Get all indexes](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes):
333334

334335
`client.getIndexes(): Promise<IndexResponse[]>`
335336

336-
- Create a new index:
337+
- [Create a new index](https://docs.meilisearch.com/reference/api/indexes.html#create-an-index):
337338

338339
`client.createIndex<T>(uid: string, options?: IndexOptions): Promise<Index<T>>`
339340

340341
- Create a local reference to an index:
341342

342343
`client.index<T>(uid: string): Index<T>`
343344

344-
- Get an index:
345-
345+
- [Get an index instance completed with information fetched from MeiliSearch](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index):
346346
`client.getIndex<T>(uid: string): Promise<Index<T>>`
347347

348-
- Get or create an index if it does not exist
348+
- Get or create an index if it does not exist:
349349

350350
`client.getOrCreateIndex<T>(uid: string, options?: IndexOptions): Promise<Index<T>>`
351351

352-
- Get Index information:
353-
352+
- [Get an object with information about the index](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index):
354353
`index.getRawInfo(): Promise<IndexResponse>`
355354

356-
- Update Index:
355+
- [Update Index](https://docs.meilisearch.com/reference/api/indexes.html#update-an-index):
357356

358357
`client.updateIndex(uid: string, options: IndexOptions): Promise<Index>`
359358
Or using the index object:
360359
`index.update(data: IndexOptions): Promise<Index>`
361360

362-
- Delete Index:
361+
- [Delete Index](https://docs.meilisearch.com/reference/api/indexes.html#delete-an-index):
363362

364363
`client.deleteIndex(uid): Promise<void>`
365364
Or using the index object:
366-
`index.delete(): Promise<void>`
367365

366+
`index.delete(): Promise<void>`
368367

369-
- Get specific index stats
368+
- [Get specific index stats](https://docs.meilisearch.com/reference/api/stats.html#get-stat-of-an-index):
370369

371370
`index.getStats(): Promise<IndexStats>`
372371

@@ -380,11 +379,11 @@ Or using the index object:
380379

381380
### Updates <!-- omit in toc -->
382381

383-
- Get One update info:
382+
- [Get One update info](https://docs.meilisearch.com/reference/api/updates.html#get-an-update-status):
384383

385384
`index.getUpdateStatus(updateId: number): Promise<Update>`
386385

387-
- Get all updates info:
386+
- [Get all updates info](https://docs.meilisearch.com/reference/api/updates.html#get-all-update-status):
388387

389388
`index.getAllUpdateStatus(): Promise<Update[]>`
390389

@@ -394,180 +393,180 @@ Or using the index object:
394393

395394
### Documents <!-- omit in toc -->
396395

397-
- Add or replace multiple documents:
396+
- [Add or replace multiple documents](https://docs.meilisearch.com/reference/api/documents.html#add-or-replace-documents):
398397

399398
`index.addDocuments(documents: Document<T>[]): Promise<EnqueuedUpdate>`
400399

401400
`index.addDocumentsInBatch(documents: Document<T>[], batchSize = 1000): Promise<EnqueuedUpdate[]>`
402401

403-
- Add or update multiple documents:
402+
- [Add or update multiple documents](https://docs.meilisearch.com/reference/api/documents.html#add-or-update-documents):
404403

405404
`index.updateDocuments(documents: Document<T>[]): Promise<EnqueuedUpdate>`
406405

407406
`index.updateDocumentsInBatch(documents: Document<T>[], batchSize = 1000): Promise<EnqueuedUpdate[]>`
408407

409-
- Get Documents:
408+
- [Get Documents](https://docs.meilisearch.com/reference/api/documents.html#get-documents):
410409

411410
`index.getDocuments(params: getDocumentsParams): Promise<Document<T>[]>`
412411

413-
- Get one document:
412+
- [Get one document](https://docs.meilisearch.com/reference/api/documents.html#get-one-document):
414413

415414
`index.getDocument(documentId: string): Promise<Document<T>>`
416415

417-
- Delete one document:
416+
- [Delete one document](https://docs.meilisearch.com/reference/api/documents.html#delete-one-document):
418417

419418
`index.deleteDocument(documentId: string | number): Promise<EnqueuedUpdate>`
420419

421-
- Delete multiple documents:
420+
- [Delete multiple documents](https://docs.meilisearch.com/reference/api/documents.html#delete-documents):
422421

423422
`index.deleteDocuments(documentsIds: string[] | number[]): Promise<EnqueuedUpdate>`
424423

425-
- Delete all documents:
424+
- [Delete all documents](https://docs.meilisearch.com/reference/api/documents.html#delete-all-documents):
426425

427426
`index.deleteAllDocuments(): Promise<Types.EnqueuedUpdate>`
428427

429428
### Settings <!-- omit in toc -->
430429

431-
- Get settings:
430+
- [Get settings](https://docs.meilisearch.com/reference/api/settings.html#get-settings):
432431

433432
`index.getSettings(): Promise<Settings>`
434433

435-
- Update settings:
434+
- [Update settings](https://docs.meilisearch.com/reference/api/settings.html#update-settings):
436435

437436
`index.updateSettings(settings: Settings): Promise<EnqueuedUpdate>`
438437

439-
- Reset settings:
438+
- [Reset settings](https://docs.meilisearch.com/reference/api/settings.html#reset-settings):
440439

441440
`index.resetSettings(): Promise<EnqueuedUpdate>`
442441

443442
### Synonyms <!-- omit in toc -->
444443

445-
- Get synonyms:
444+
- [Get synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#get-synonyms):
446445

447446
`index.getSynonyms(): Promise<object>`
448447

449-
- Update synonyms:
448+
- [Update synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#update-synonyms):
450449

451450
`index.updateSynonyms(synonyms: Synonyms): Promise<EnqueuedUpdate>`
452451

453-
- Reset synonyms:
452+
- [Reset synonyms](https://docs.meilisearch.com/reference/api/synonyms.html#reset-synonyms):
454453

455454
`index.resetSynonyms(): Promise<EnqueuedUpdate>`
456455

457456
### Stop-words <!-- omit in toc -->
458457

459-
- Get Stop Words
458+
- [Get Stop Words](https://docs.meilisearch.com/reference/api/stop_words.html#get-stop-words):
460459
`index.getStopWords(): Promise<string[]>`
461460

462-
- Update Stop Words
461+
- [Update Stop Words](https://docs.meilisearch.com/reference/api/stop_words.html#update-stop-words):
463462
`index.updateStopWords(stopWords: string[] | null ): Promise<EnqueuedUpdate>`
464463

465-
- Reset Stop Words
464+
- [Reset Stop Words](https://docs.meilisearch.com/reference/api/stop_words.html#reset-stop-words):
466465
`index.resetStopWords(): Promise<EnqueuedUpdate>`
467466

468467
### Ranking rules <!-- omit in toc -->
469468

470-
- Get Ranking Rules
469+
- [Get Ranking Rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#get-ranking-rules):
471470
`index.getRankingRules(): Promise<string[]>`
472471

473-
- Update Ranking Rules
472+
- [Update Ranking Rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#update-ranking-rules):
474473
`index.updateRankingRules(rankingRules: string[] | null): Promise<EnqueuedUpdate>`
475474

476-
- Reset Ranking Rules
475+
- [Reset Ranking Rules](https://docs.meilisearch.com/reference/api/ranking_rules.html#reset-ranking-rules):
477476
`index.resetRankingRules(): Promise<EnqueuedUpdate>`
478477

479478
### Distinct Attribute <!-- omit in toc -->
480479

481-
- Get Distinct Attribute
480+
- [Get Distinct Attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#get-distinct-attribute):
482481
`index.getDistinctAttribute(): Promise<string | void>`
483482

484-
- Update Distinct Attribute
483+
- [Update Distinct Attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#update-distinct-attribute):
485484
`index.updateDistinctAttribute(distinctAttribute: string | null): Promise<EnqueuedUpdate>`
486485

487-
- Reset Distinct Attribute
486+
- [Reset Distinct Attribute](https://docs.meilisearch.com/reference/api/distinct_attribute.html#reset-distinct-attribute):
488487
`index.resetDistinctAttribute(): Promise<EnqueuedUpdate>`
489488

490489
### Searchable Attributes <!-- omit in toc -->
491490

492-
- Get Searchable Attributes
491+
- [Get Searchable Attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#get-searchable-attributes):
493492
`index.getSearchableAttributes(): Promise<string[]>`
494493

495-
- Update Searchable Attributes
494+
- [Update Searchable Attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#update-searchable-attributes):
496495
`index.updateSearchableAttributes(searchableAttributes: string[] | null): Promise<EnqueuedUpdate>`
497496

498-
- Reset Searchable Attributes
497+
- [Reset Searchable Attributes](https://docs.meilisearch.com/reference/api/searchable_attributes.html#reset-searchable-attributes):
499498
`index.resetSearchableAttributes(): Promise<EnqueuedUpdate>`
500499

501500
### Displayed Attributes <!-- omit in toc -->
502501

503-
- Get Displayed Attributes
502+
- [Get Displayed Attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#get-displayed-attributes):
504503
`index.getDisplayedAttributes(): Promise<string[]>`
505504

506-
- Update Displayed Attributes
505+
- [Update Displayed Attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#update-displayed-attributes):
507506
`index.updateDisplayedAttributes(displayedAttributes: string[] | null): Promise<EnqueuedUpdate>`
508507

509-
- Reset Displayed Attributes
508+
- [Reset Displayed Attributes](https://docs.meilisearch.com/reference/api/displayed_attributes.html#reset-displayed-attributes):
510509
`index.resetDisplayedAttributes(): Promise<EnqueuedUpdate>`
511510

512511
### Filterable Attributes <!-- omit in toc -->
513512

514-
- Get Filterable Attributes
513+
- [Get Filterable Attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#get-filterable-attributes):
515514
`index.getFilterableAttributes(): Promise<string[]>`
516515

517-
- Update Filterable Attributes
516+
- [Update Filterable Attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#update-filterable-attributes):
518517
`index.updateFilterableAttributes(filterableAttributes: string[] | null): Promise<EnqueuedUpdate>`
519518

520-
- Reset Filterable Attributes
519+
- [Reset Filterable Attributes](https://docs.meilisearch.com/reference/api/filterable_attributes.html#reset-filterable-attributes):
521520
`index.resetFilterableAttributes(): Promise<EnqueuedUpdate>`
522521

523522
### Sortable Attributes <!-- omit in toc -->
524523

525-
- Get Sortable Attributes
524+
- [Get Sortable Attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#get-sortable-attributes):
526525
`index.getSortableAttributes(): Promise<string[]>`
527526

528-
- Update Sortable Attributes
527+
- [Update Sortable Attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#update-sortable-attributes):
529528
`index.updateSortableAttributes(sortableAttributes: string[] | null): Promise<EnqueuedUpdate>`
530529

531-
- Reset Sortable Attributes
530+
- [Reset Sortable Attributes](https://docs.meilisearch.com/reference/api/sortable_attributes.html#reset-sortable-attributes):
532531
`index.resetSortableAttributes(): Promise<EnqueuedUpdate>`
533532

534533
### Keys <!-- omit in toc -->
535534

536-
- Get keys
535+
- [Get keys](https://docs.meilisearch.com/reference/api/keys.html#get-keys):
537536

538537
`client.getKeys(): Promise<Keys>`
539538

540539
### isHealthy <!-- omit in toc -->
541540

542-
- Return `true` or `false` depending on the health of the server.
541+
- [Return `true` or `false` depending on the health of the server](https://docs.meilisearch.com/reference/api/health.html#get-health):
543542

544543
`client.isHealthy(): Promise<boolean>`
545544

546545
### Health <!-- omit in toc -->
547546

548-
- Check if the server is healthy
547+
- [Check if the server is healthy](https://docs.meilisearch.com/reference/api/health.html#get-health):
549548

550549
`client.health(): Promise<Health>`
551550

552551
### Stats <!-- omit in toc -->
553552

554-
- Get database stats
553+
- [Get database stats](https://docs.meilisearch.com/reference/api/stats.html#get-stats-of-all-indexes):
555554

556555
`client.getStats(): Promise<Stats>`
557556

558557
### Version <!-- omit in toc -->
559558

560-
- Get binary version
559+
- [Get binary version](https://docs.meilisearch.com/reference/api/version.html#get-version-of-meilisearch):
561560

562561
`client.getVersion(): Promise<Version>`
563562

564563
### Dumps <!-- omit in toc -->
565564

566-
- Trigger a dump creation process
565+
- [Trigger a dump creation process](https://docs.meilisearch.com/reference/api/dump.html#create-a-dump):
567566

568567
`client.createDump(): Promise<Types.EnqueuedDump>`
569568

570-
- Get the status of a dump creation process
569+
- [Get the status of a dump creation process](https://docs.meilisearch.com/reference/api/dump.html#get-dump-status):
571570

572571
`client.getDumpStatus(dumpUid: string): Promise<Types.EnqueuedDump>`
573572

src/lib/indexes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
SortableAttributes,
3434
SearchableAttributes,
3535
DisplayedAttributes,
36-
FetchError,
3736
} from '../types'
3837
import { sleep, removeUndefinedFromObject } from './utils'
3938
import { HttpRequests } from './http-requests'
@@ -225,7 +224,7 @@ class Index<T = Record<string, any>> {
225224
try {
226225
await this.delete()
227226
return true
228-
} catch (e: any | FetchError) {
227+
} catch (e) {
229228
if (e.errorCode === 'index_not_found') {
230229
return false
231230
}

0 commit comments

Comments
 (0)