我使用Sytrfony2创建了一个多语言网站,使用Doctrine2的(Gedmo)可翻译行为扩展。这工作正常,但现在我正在寻找一种方法来使用ElasticaBundle创建一个很好的searchoption。我希望德国用户使用德语翻译进行搜索,也可以使用英语翻译。
目前我正在尝试为每种语言使用单独的索引。我的config.yml看起来像这样:
foq_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
articles_en:
client:default
types:
article:
mappings:
name: { boost: 5, analyzer: my_analyzer }
persistence:
driver: orm
model: Test\SiteBundle\Entity\Article
identifier: id
provider:
service: elastica.translation.provider.article.en
finder:
articles_de:
....
articles_nl:
.....
如果您想搜索一个索引但是使用此捆绑包搜索两个索引似乎不可能,或者我错了,这可以正常工作吗?
有办法做到这一点吗?任何帮助将不胜感激!
瑞克
答案 0 :(得分:4)
您应该只为每种语言的每篇文章添加一个索引,并为索引添加一种语言。然后,您可以在索引中搜索一种或多种语言的文章。