猿问

狮身人面像QL组 BY 重复分组ID

当我在Manticore中使用GROUP BY语法时,有重复的分组ID的结果。我们刚刚从狮身人面像2.X迁移到最新的Manticore,在狮身人面像中没有这个具有相同查询的序幕。


这是狮身人面像QL查询:


SELECT model_id, model_root, model_name FROM search WHERE model_id != 0 GROUP BY model_root WITHIN GROUP ORDER BY model_level ASC ORDER BY model_level ASC, model_occurrence DESC, model_name ASC LIMIT 0, 13


因此,将model_root分组,并且在->10,11(Cannon)处有一个重复的键->这不是我所期望的。


结果如下:


array:13 [▼

  0 => array:3 [▼

    "model_id" => "62763"

    "model_root" => "62763"

    "model_name" => "HP"

  ]

  1 => array:3 [▼

    "model_id" => "72771"

    "model_root" => "72771"

    "model_name" => "Sony"

  ]

  2 => array:3 [▼

    "model_id" => "72524"

    "model_root" => "72524"

    "model_name" => "Compaq"

  ]

  3 => array:3 [▼

    "model_id" => "62783"

    "model_root" => "62783"

    "model_name" => "Samsung"

  ]

  4 => array:3 [▼

    "model_id" => "62760"

    "model_root" => "62760"

    "model_name" => "Asus"

  ]

  5 => array:3 [▼

    "model_id" => "62761"

    "model_root" => "62761"

    "model_name" => "Toshiba"

  ]

  6 => array:3 [▼

    "model_id" => "85086"

    "model_root" => "85086"

    "model_name" => "Panasonic"

  ]

  7 => array:3 [▼

    "model_id" => "151763"

    "model_root" => "151763"

    "model_name" => "Acer"

  ]

  8 => array:3 [▼

    "model_id" => "72548"

    "model_root" => "72548"

    "model_name" => "Packard Bell"

  ]

  9 => array:3 [▼

    "model_id" => "62762"

    "model_root" => "62762"

    "model_name" => "Lenovo"

  ]

  10 => array:3 [▼

    "model_id" => "83072"

    "model_root" => "83072"

    "model_name" => "Canon"

  ]

  11 => array:3 [▼

    "model_id" => "83072"

    "model_root" => "83072"

    "model_name" => "Canon"

  ]

  12 => array:3 [▼

    "model_id" => "73476"

    "model_root" => "73476"

    "model_name" => "LG"

  ]

]

预期:


array:13 [▼

  0 => array:3 [▼

    "model_id" => "62763"

    "model_root" => "62763"

    "model_name" => "HP"

  ]

  1 => array:3 [▼

    "model_id" => "72771"

    "model_root" => "72771"

    "model_name" => "Sony"

  ]


任何想法 查询或索引定义有什么问题?


繁花如伊
浏览 106回答 1
1回答

肥皂起泡泡

我已经重现了您的问题。是的,在这种情况下,Manticore的行为有所不同,与狮身人面像2.x相比,默认max_matches值(1000)很可能是不够的。如果您提供的测试max_matches = 1025应该足够了(而在狮身人面像2.2中,它是892)。在您的生产案例中,请自己尝试最佳价值。请在此处阅读有关max_matches如何影响分组结果的信息,https://docs.manticoresearch.com/latest/html/searching/grouping_clustering_search_results.html
随时随地看视频慕课网APP
我要回答