为什么以下查询返回不同的结果?更多细节
- 我想获得所有活跃的帖子,按 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);
教义2查询:
$posts = $this
->getDoctrine()
->getRepository('ItlizedFairdomBundle:Post')
->findBy(array('status' => PostModel::STATUS_ACTIVE), array('tttAt' => 'DESC'));