0

我已经安装了 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"

坚持is_indexable_callback工作。但是当我运行时fos:elastica:populate,即使是隐藏对象也会创建索引。

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

提前致谢!

4

1 回答 1

0

您应该指定:

provider:
    query_builder_method: createSearchIndexQueryBuilder

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

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

    return $qb;
}
于 2014-04-03T16:27:53.527 回答