PHP 5.6.0RC3 is available


(PECL solr >= 0.9.2)

SolrQuery::setMltHabilita o deshabilita moreLikeThis


public SolrQuery SolrQuery::setMlt ( bool $flag )

Habilita o deshabilita moreLikeThis



TRUE lo habilita y FALSE lo desactiva.

Valores devueltos

Devuelve el objeto SolrQuery actual, si se usó el valor de retorno.

add a note add a note

User Contributed Notes 1 note

duerra at nospam dot yahoo dot com
3 years ago
Note that currently, if enabling MLT results in Solr, you also need to set the MinDocFrequency and MinTermFrequency, or you will not get any results back.

= new SolrClient($params);
$query = new SolrQuery();

//What the MLT documents will be based off of
$result = $client->query($query);
$response = $result->getResponse();

//MLT returns an array of documents based off of the id field value of EACH result returned in the primary search, with an array of MLT documents for each main result document returned

//Presuming the unique field in our schema above is "id" and I know that I will only be getting one document returned in the primary result set, then:
$similarDocs = $response->moreLikeThis->doc_10->docs;


Hope this helps.
To Top