More like this only work with min_term_freq = 1


(Post) #1

Hi,

i'm a new user but elastic search is amazing! I use it for a PHP
project and use the elastica php client.

I created an index and insert 30.000 documents. With mysql i search
title like 'foo bar boo' and he finds 5 entrys. If i try eleastic
search with the more like this function i doesn't find any entry. Only
if if i set min_term_freq to 1.

I thing it musst be an error on analyzing the text?

The Code:
$queryMlt = new Elastica_Query_MoreLikeThis();
$queryMlt->setFields(array('humanTitle'));
$queryMlt->setLikeText(strtolower($filter['mltTitle']));
$queryMlt->setMinTermFrequency(2);
$queryMlt->setAnalyzer('whitespace');
$queryBool->addMust($queryMlt);
Doesn't find any thing.

The Mapping is like this:
$mapping = array(
'title' => array('type' => 'string', 'store' =>
'yes','index'=>'analyzed','analyzer'=>'simple'),
'humanTitle' => array('type' => 'string', 'store' =>
'yes','index'=>'analyzed'),
'categoryId' => array('type' => 'integer', 'store' =>
'yes'),
'showDate' => array('type' => 'string', 'store' =>
'no'),
'genre' => array('type' => 'string', 'store' =>
'no','index'=>'analyzed'),
'image' => array('type' => 'string', 'store' =>
'yes','index'=>'no'),
'status' => array('type' => 'string', 'store' =>
'no','index'=>'analyzed'),
);

Where is the fault?


(system) #2