note 100986 added to solrquery.setmlt

From: Date: Fri, 19 Nov 2010 00:34:17 +0000
Subject: note 100986 added to solrquery.setmlt
Groups: php.notes 
Request: Send a blank email to php-notes+get-174167@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 67.108.10.115 ---- Manual Page -- http://www.php.net/manual/en/solrquery.setmlt.php Edit -- https://master.php.net/note/edit/100986 Del: integrated -- https://master.php.net/note/delete/100986/integrated Del: useless -- https://master.php.net/note/delete/100986/useless Del: bad code -- https://master.php.net/note/delete/100986/bad+code Del: spam -- https://master.php.net/note/delete/100986/spam Del: non-english -- https://master.php.net/note/delete/100986/non-english Del: in docs -- https://master.php.net/note/delete/100986/in+docs Del: other reasons-- https://master.php.net/note/delete/100986 Reject -- https://master.php.net/note/reject/100986 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174167) next »