Skip to content

Give the possibility to set the attributesToXXX #736

@irevoire

Description

@irevoire

Description
I noticed that some of our users, for example meilisearch.com, had large documents but only needs one or two fields.
For example in the case of meilisearch.com we are querying this very large JSON TWICE when all we need is actually the two selected fields;
image

It would be cool if instant-meilisearch was able to detect which fields are used (but I highly doubt that's possible) or if we could specify ourselves the attributesToRetrieve, attributesToHighlight and attributesToCrop settings.

Basic example

      instantMeiliSearch(
        process.env.NEXT_PUBLIC_DEMO_MOVIES_HOST,
        process.env.NEXT_PUBLIC_DEMO_MOVIES_API_KEY,
        {
          paginationTotalHits: 4,
          primaryKey: 'id',
          attributesToRetrieve: ["poster_path"],
          attributesToHighlight: ["title"],
        }
      )

Other
To give you an idea, on meilisearch.com that would make the size of each request goes from 23675 bytes to 980.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions