meilisearch / meilisearch/meilisearch-js-plugins

Extract query from instant-meilisearch

Open
#952 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

support
Dominant language
TypeScript
Stars
531
Forks
71
Avg merge
10d 14h
Merged PRs (30d)
2

Description

Hi there! Thanks for creating and maintaining this :)

I was trying to build an export feature for my search UI, where users should be able to download all the results that they are looking at (+ the following pages included). I thought the way I could achieve this, is to extract the current Query from somewhere, and then do that search manually. That way, I can handle a larger amount of responses.

But how do I access this search query?

I can see that instantMeiliSearch creates a meilisearch client instance and calls .search at some point.

I want to call that .search manually, using a Query built from the current UI state. I'm not quite sure how to do this. I could just fetch the /search endpoint, but I still want to use my currently selected facets / values.

Some API suggestions:

  • instantMeiliSearch returns a currentQuery object, which represents the JSON body sent to the server for a search.
  • useCurrentQuery hook that does something similar?

I'm using:

    "@meilisearch/instant-meilisearch": "^0.10.1",
    "meilisearch": "^0.29.1",
    "instantsearch.js": "^4.49.1",
    "react-instantsearch-hooks-web": "^6.38.0",

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the instantMeiliSearch implementation and the meilisearch client search call described in the issue. Determine how the current InstantSearch UI state and selected facets could be exposed for manual searches, then define and document an API or hook whose returned query matches the request sent to the server.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
api, frontend, search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.