public static function SearchApiElasticsearchElasticaMLT::build in Search API Elasticsearch 7
1 call to SearchApiElasticsearchElasticaMLT::build()
- SearchApiElasticsearchElasticaSearcher::search in modules/
elastica/ includes/ SearchApiElasticsearchElasticaSearcher.inc
File
- modules/
elastica/ includes/ SearchApiElasticsearchElasticaMLT.inc, line 10 - Contains handler for More Like This queries.
Class
- SearchApiElasticsearchElasticaMLT
- @file Contains handler for More Like This queries.
Code
public static function build($type, $options, $query, SearchApiQueryInterface $search_api_query) {
self::filterFields($options['mlt']['fields'], $search_api_query);
$mlt_query = new Elastica\Query\MoreLikeThis();
$mlt_query
->setFields(array_values($options['mlt']['fields']));
$mlt_query
->setParam('ids', array(
$options['mlt']['id'],
));
$mlt_query
->setMinDocFrequency($options['mlt']['min_doc_freq']);
$mlt_query
->setMinTermFrequency($options['mlt']['min_term_freq']);
$query
->setQuery($mlt_query);
if (!empty($options['query_search_filter'])) {
$query
->setQuery(new Elastica\Query\Filtered($mlt_query, $options['query_search_filter']));
}
}