Elastica结果:如何在搜索整个索引时获取doctrine对象

时间:2015-01-18 19:36:53

标签: symfony doctrine-orm elasticsearch elastica foselasticabundle

继续发现FOSElasticaBundle。

现在我知道如何检索实际的教义实体:

    $finder = $this->get('fos_elastica.finder.website.recipe');
    $results = $finder->find($search);

与Elastica \ Result实例相反:

    $finder = $this->get('fos_elastica.index.website.recipe');
    $results = $finder->search($search);
然而,似乎我可以打电话

$finder = $this->get('fos_elastica.index.website');

但我不能打电话

$finder = $this->get('fos_elastica.finder.website');

那么如何检索整个索引的搜索学说对象结果呢?

1 个答案:

答案 0 :(得分:0)

As long as you have finder set to ~ in your config.yml file, you should be searching the entire website. Here's an example file that shows this in action.

                persistence:
                    driver: orm
                    model: Acme\ApplicationBundle\Entity\User
                    provider: ~
                    listener:
                        immediate: ~
                    finder: ~