【问题标题】:Doctrine ORM to Elastic search queryDoctrine ORM 到 Elastic 搜索查询
【发布时间】:2016-06-23 11:11:45
【问题描述】:

大家好,我现在正在用这个东西敲我的头。我正在尝试将其转换为弹性搜索查询,例如

    $boolQuery = new \Elastica\Query\BoolQuery();
    $fieldQuery = new \Elastica\Query\Match();
    $fieldQuery->setFieldQuery('title', 'searchTern');
    $boolQuery->addShould($fieldQuery);

.. 但到目前为止,我的努力是徒劳的

这是我的 Doctrine ORM 查询:

   return $this->createQueryBuilder('article')
                    ->addSelect('aTrans')
                    ->join('article.translations', 'aTrans')
                    ->join('NameSpace\Entity\Article', 'front',
                               'WITH', 'front.article = article')
                    ->andWhere('aTrans.locale = :locale')
                    ->setParameter("locale", $locale)
                    ->andWhere('article.isActive = true')
                    ->orderBy('article.createdAt', 'DESC')
                    ->setMaxResults($limit)

【问题讨论】:

    标签: elasticsearch doctrine-orm foselasticabundle


    【解决方案1】:

    在弹性搜索中,您实际上并没有进行联接。 Elasticsearch 通过处理非规范化数据获得了速度。这基本上意味着您在索引中拥有所需的所有数据。查看关于 here 的 elasticsearch 文档。

    您还应该阅读 elasticsearch 的 this 文档。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-09
      • 2014-04-19
      • 2011-03-29
      • 1970-01-01
      • 2020-08-21
      • 2013-06-19
      • 2021-06-12
      • 1970-01-01
      相关资源
      最近更新 更多