0

次のクエリが異なる結果を返すのはなぜですか? 詳しくは

  • すべてのアクティブな投稿を取得したいのですが、tttAt の降順で並べ替えます。
  • Doctrine2 は期待した結果を返しますが、FOSElasticaBundle ではありません
  • Doctrine2 はすべてのレコードを返しますが、FOSElasticaBundle は最初の 10 個のレコードのみを返しますが、Doctrine の最初の 10 個のレコードでさえ FOSElasticaBundle のものとは異なるため、これを無視してください。

FOSElasticaBundle クエリ:

    /** @var TransformedFinder $finder */
    $finder = $this->container->get('fos_elastica.finder.index_name.post');
    $query = new Query();
    $filter = new Term(array('status' => PostModel::STATUS_ACTIVE));
    $query->setFilter($filter);
    $query->addSort(array('tttAt' => array('order' => 'desc')));
    $posts = $finder->find($query);

Doctrine2 クエリ:

    $posts = $this
        ->getDoctrine()
        ->getRepository('ItlizedFairdomBundle:Post')
        ->findBy(array('status' => PostModel::STATUS_ACTIVE), array('tttAt' => 'DESC'));
4

1 に答える 1

0

理由を見つけました。MySQL のデータがインポートされているため、ES は MySQL と同期していないため、ES は DB の変更 (挿入、更新、削除など) を認識していませんでした。

を実行した後app/console fos:elastica:populate、結果は同じになりました...

悪い!ありがとう@Tomdarkness :)

于 2014-04-06T07:31:57.720 に答える