FOSElasticaBundle索引隐藏的对象

时间:2014-04-03 10:49:01

标签: symfony elasticsearch foselasticabundle

我已经安装了FOSElasticaBundle,我的配置fos_elastica.yml如下:

 fos_elastica:
 clients:
     default: { host: localhost, port: 9200 }
 indexes:
     test:
         client: default
         index_name : %elastica_index_name%
         types:
             exhibition:
                 mappings:
                     name : { boost: 100 }
                     company: { boost: 9 }
                     directions: { boost: 8}
                     tags: { boost: 7 }
                     description : { boost: 6 }
                     status : ~
                 persistence:
                     driver: orm
                     model: Test\MainBundle\Entity\Exhibition
                     finder: ~
                     provider: ~
                     listener:
                         is_indexable_callback: "isPublic"

on persist is_indexable_callback有效。但是当我运行fos:elastica:populate时,即使对于隐藏对象也会创建索引。

如何索引活动对象?也许使用分析仪或类似的东西?

提前致谢!

1 个答案:

答案 0 :(得分:0)

您应该指定:

provider:
    query_builder_method: createSearchIndexQueryBuilder

然后将方法添加到相关的Entity\Repository

public function createSearchIndexQueryBuilder()
{
    $qb = $this->createQueryBuilder()
    //->write_magic_here;

    return $qb;
}