private function addForIndex($query, $indexName, $index) { $sub = new Search_Query(); foreach ($index->getTransformations() as $trans) { $sub->applyTransform($trans); } $query->includeForeign($indexName, $sub); return $sub; }
function testTransformsApplyPerIndex() { $query = new Search_Query('Hello'); $query->applyTransform(new Search\Federated\UrlPrefixTransform('http://foo.example.com')); $sub = new Search_Query('Hello'); $sub->applyTransform(new Search\Federated\UrlPrefixTransform('http://bar.example.com/')); $query->includeForeign('test_index_c', $sub); $result = $query->search($this->indexA); $urls = [$result[0]['url'], $result[1]['url']]; $this->assertContains('http://foo.example.com/PageA', $urls); $this->assertContains('http://bar.example.com/PageC', $urls); }