meilisearch/MeiliSearch

`searchableAttributes` change order of fields in response hits

开放

#1,495 创建于 2021年7月7日

 (24 条评论) (0 个反应) (0 位负责人)Rust (2,542 个派生)batch import
bugcontribution acceptedhelp wanted

仓库指标

星标
 (57,572 个星标)
PR 合并指标
 (平均合并 11天 20小时) (30 天内合并 41 个 PR)

描述

Describe the bug

When adding fields in searchableAttributes the order of fields in the returned document are impacted:

{
  "searchableAttributes": [
    "title",
    "description"
  ],
  "filterableAttributes": [
    "genres"
  ]
}

id field of document goes from first position to second position. Given this document:

{
  "id": 28,
  "title": "Apocalypse Now",
  "overview": "At the height of the Vietnam war, Captain Benjamin Willard is sent on a dangerous mission that, officially, \"does not exist, nor will it ever exist.\" His goal is to locate - and eliminate - a mysterious Green Beret Colonel named Walter Kurtz, who has been leading his personal army on illegal guerrilla missions into enemy territory.",
  "genres": [
    "Drama",
    "War"
  ],
  "poster": "https://image.tmdb.org/t/p/w500/gQB8Y5RCMkv2zwzFHbUJX3kAhvA.jpg",
  "release_date": 303523200
}

after a search this is how it is returned in the response body:

        {
            "title": "Apocalypse Now",
            "id": 28,
            "overview": "At the height of the Vietnam war, Captain Benjamin Willard is sent on a dangerous mission that, officially, \"does not exist, nor will it ever exist.\" His goal is to locate - and eliminate - a mysterious Green Beret Colonel named Walter Kurtz, who has been leading his personal army on illegal guerrilla missions into enemy territory.",
            "genres": [
                "Drama",
                "War"
            ],
            "poster": "https://image.tmdb.org/t/p/w500/gQB8Y5RCMkv2zwzFHbUJX3kAhvA.jpg",
            "release_date": 303523200
        },

Expected behavior Same order

MeiliSearch Version: 0.21.0

贡献者指南