我的网络应用程序中有一个搜索表单,用户可以在其中按姓名、俱乐部名称搜索其他人……这是我用于搜索的代码,但它没有给我任何“点击”。
$search = $this->get('ewz_search.lucene');
$query = new MultiTerm();
$query->addTerm(new Term($form->getData()->getName()));
$query->addTerm(new Term($form->getData()->getClub()->getId()));
// See point 1 to see what this displays
var_dump($query);
// See point 2 to see what this displays
die("debug: " . $query);
// If I use this instead of the MultiTerm, I do get a hit
// $query = 'Mathew';
$hits = $search->find($query);
第 1 点:对象(Zend\Search\Lucene\Search\Query\MultiTerm)#644 (9) { ["_terms":"Zend\Search\Lucene\Search\Query\MultiTerm":private]=> 数组(2) { [0]=> object(Zend\Search\Lucene\Index\Term)#638 (2) { ["field"]=> NULL ["text"]=> string(12) "Mathew" } [1] => object(Zend\Search\Lucene\Index\Term)#637 (2) { ["field"]=> NULL ["text"]=> int(1) } } ["_signs":"Zend\Search \Lucene\Search\Query\MultiTerm":private]=> array(2) { [0]=> NULL [1]=> NULL } ["_resVector":"Zend\Search\Lucene\Search\Query\MultiTerm" :private]=> NULL ["_termsFreqs":"Zend\Search\Lucene\Search\Query\MultiTerm":private]=> array(0) { } ["_coord":"Zend\Search\Lucene\Search\Query \MultiTerm":private]=>NULL ["_weights":"Zend\Search\Lucene\Search\Query\MultiTerm":private]=> array(0) { } ["_boost":"Zend\Search\Lucene\Search\Query\AbstractQuery":private ]=> int(1) ["_weight":protected]=> NULL ["_currentColorIndex":"Zend\Search\Lucene\Search\Query\AbstractQuery":private]=> int(0) }
第 2 点:调试:Mathew 1
谢谢。