我在我的項目中使用FOSElasticaBundle搜索我的Player
實體。正如我只想搜索實體上的值1
財產isactive
,我也跟着上的文檔「篩選結果和執行默認查詢」:FriendsOfSymfony/FOSElasticaBundle/README.md排序在FOSElasticaBundle
$query = new \Elastica\Query\QueryString($searchterm);
$term = new \Elastica\Filter\Term(array('isactive' => true));
$filteredQuery = new \Elastica\Query\Filtered($query, $term);
$players = $this->get('fos_elastica.finder.xxx.player')->find($filteredQuery);
我包的構造看起來如下:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
serializer:
callback_class: FOS\ElasticaBundle\Serializer\Callback
serializer: serializer
indexes:
xxx:
client: default
types:
player:
mappings:
firstname: { boost: 3 }
lastname: { boost: 3 }
serializer:
groups: [elastica, Default]
persistence:
driver: orm
model: xxx\FrontendBundle\Entity\Player
listener: ~
provider: ~
finder: ~
現在我想做一些排序並削減限制和抵消的結果。我怎樣才能做到這一點?
我發現像
$finalQuery = new \Elastica\Query($boolQuery);
$finalQuery->setSort(array('price' => array('order' => 'asc')));
的解決方案,但我沒有一個彈性曲線\查詢對象和AbstractQuery不支持這個方法。相同
$elasticaQuery->addSort($sort);
怎麼辦?在哪裏閱讀? ://
(另外,如果我們已經在這裏:這是什麼{升壓:3}?真正做到完全一致)
Elasticsearch正在搜索中提升重要性,而Elasticsearch正在搜索https://www.elastic.co/guide/en/elasticsearch/guide/current/query-time-boosting.html –