私はSymfony2でElasticSearchBundleをいじり始めましたが、エンティティを使った検索機能について質問があります。
このような構成がある場合:
foq_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
website:
client: default
types:
user:
mappings:
username: { boost: 5 }
firstName: { boost: 3 }
persistence:
driver: orm # orm, mongodb, propel are available
model: Application\UserBundle\Entity\User
provider:
次に、次のようにインデックスを検索できます。
$userType = $this->container->get('foq_elastica.index.website.user');
$resultSet = $userType->search('bob');
しかし、単一の関数で複数のエンティティを検索したい場合はどうでしょうか。何かのようなもの...
構成:
foq_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
website:
client: default
types:
user:
mappings:
username: { boost: 5 }
firstName: { boost: 3 }
persistence:
driver: orm
model: Application\UserBundle\Entity\User
provider:
client:
mappings:
clientname: { boost: 5 }
persistence:
driver: orm
model: Application\UserBundle\Entity\Client
provider:
検索機能:
$Type = $this->container->get(['foq_elastica.index.website.user', 'foq_elastica.index.website.client']);
$resultSet = $Type->search('bob');
上記のコードは機能しませんが、複数のエンティティで単一の検索を実行し、それらのブーストプロパティに基づいて結果を取得するような方法があるかどうか疑問に思いましたか?