downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

SolrQuery::setMltBoost> <SolrQuery::setHighlightUsePhraseHighlighter
[edit] Last updated: Fri, 24 Jun 2011

view this page in

SolrQuery::setMlt

(PECL solr >= 0.9.2)

SolrQuery::setMltفعال‌سازی یا غیرفعال‌سازی moreLikeThis

Description

publicSolrQuery SolrQuery::setMlt ( bool $flag )

فعال‌سازی یا غیرفعال‌سازی moreLikeThis

Parameters

flag

TRUE برای فعال‌سازی و FALSE برای غیرفعال‌سازی.

Return Values

بازگرداندن شی فعلی SolrQuery اگر مقدار بازگشت استفاده شده باشد.



add a note add a note User Contributed Notes SolrQuery::setMlt - [1 notes]
up
0
duerra at nospam dot yahoo dot com
2 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.

<?php
$client
= new SolrClient($params);
$query = new SolrQuery();
$query->setMlt(true);
$query->addField('*,score');
$query->setMltMinDocFrequency(1);
$query->setMltMinTermFrequency(1);

//What the MLT documents will be based off of
$query->setQuery('id:doc_10');
$result = $client->query($query);
$result->setParseMode(SolrQueryResponse::PARSE_SOLR_OBJ);
$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.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites