コード例 #1
0
ファイル: MoreLikeThisTest.php プロジェクト: rjsmelo/tiki
 function testDocumentTooDifferent()
 {
     $query = new Search_Query();
     $query->filterSimilar('wiki page', 'X');
     $results = $query->search($this->index);
     $this->assertCount(0, $results);
 }
コード例 #2
0
ファイル: QueryBuilderTest.php プロジェクト: linuxwhy/tiki-1
 function testMoreLikeThisThroughAbstraction()
 {
     $builder = new QueryBuilder();
     $builder->setDocumentReader(function ($type, $object) {
         return array('object_type' => $type, 'object_id' => $object, 'contents' => 'hello world');
     });
     $q = new Search_Query();
     $q->filterSimilar('wiki page', 'A');
     $query = $builder->build($q->getExpr());
     $this->assertEquals(array('bool' => array('must' => array(array('more_like_this' => array('fields' => array('contents'), 'like_text' => 'hello world', 'boost' => 1.0))), 'must_not' => array(array('bool' => array('must' => array(array("match" => array("object_type" => array("query" => "wiki page"))), array("match" => array("object_id" => array("query" => "A"))))))))), $query['query']);
 }
コード例 #3
0
ファイル: TikiIndex.php プロジェクト: rjsmelo/tiki
 function applySimilarConditions(\Search_Query $query, $type, $object)
 {
     $query->filterSimilar($type, $object);
     $this->applyRaw($query);
 }
コード例 #4
0
ファイル: ManifoldCfIndex.php プロジェクト: linuxwhy/tiki-1
 function applySimilarConditions(\Search_Query $query, $type, $object)
 {
     $query->filterSimilar($type, $object, 'file');
 }