| @@ 140-161 (lines=22) @@ | ||
| 137 | ||
| 138 | */ |
|
| 139 | ||
| 140 | public function testSimilarGood() { |
|
| 141 | $fp = $this->objFromFixture('FlickrPhotoTO', 'photo0076'); |
|
| 142 | $es = new ElasticSearcher(); |
|
| 143 | $es->setClasses('FlickrPhotoTO'); |
|
| 144 | $fields = array('Title.standard' => 1, 'Description.standard' => 1); |
|
| 145 | $paginated = $es->moreLikeThis($fp, $fields, true); |
|
| 146 | foreach ($paginated->getList() as $result) { |
|
| 147 | echo $result->ID. ' : '.$result->Title."\n"; |
|
| 148 | } |
|
| 149 | $this->assertEquals(32, $paginated->getTotalItems()); |
|
| 150 | $results = $paginated->getList()->toArray(); |
|
| 151 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Railroad Station, Stockdale, Texas]", $results[0]->Title); |
|
| 152 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Railroad Station, Taft, Texas]", $results[1]->Title); |
|
| 153 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Railroad Station, Sierra Blanca, Texas]", $results[2]->Title); |
|
| 154 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Freight Station, Waxahachie, Texas]", $results[3]->Title); |
|
| 155 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Passenger Station, Waxahachie, Texas]", $results[4]->Title); |
|
| 156 | $this->assertEquals("[Texas and New Orleans, Southern Pacific, Tower No. 63, Mexia, Texas]", $results[5]->Title); |
|
| 157 | $this->assertEquals("[Texas and New Orleans, Southern Pacific, Eakin Street Yard Office, Dallas, Texas]", $results[6]->Title); |
|
| 158 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Locomotive Scrap Line, Englewood Yards, Houston, Texas]", $results[7]->Title); |
|
| 159 | $this->assertEquals("[Texas and New Orleans, Southern Pacific, Switchman's Tower, San Antonio, Texas]", $results[8]->Title); |
|
| 160 | $this->assertEquals("Flash Light view in new Subterranean", $results[9]->Title); |
|
| 161 | } |
|
| 162 | ||
| 163 | ||
| 164 | /* |
|
| @@ 126-147 (lines=22) @@ | ||
| 123 | } |
|
| 124 | } |
|
| 125 | ||
| 126 | public function testSimilarGood() { |
|
| 127 | $fp = $this->objFromFixture('FlickrPhotoTO', 'photo0076'); |
|
| 128 | $es = new ElasticSearcher(); |
|
| 129 | $es->setClasses('FlickrPhotoTO'); |
|
| 130 | $fields = array('Title.standard' => 1, 'Description.standard' => 1); |
|
| 131 | $paginated = $es->moreLikeThis($fp, $fields, true); |
|
| 132 | foreach ($paginated->getList() as $result) { |
|
| 133 | echo $result->ID. ' : '.$result->Title."\n"; |
|
| 134 | } |
|
| 135 | $this->assertEquals(32, $paginated->getTotalItems()); |
|
| 136 | $results = $paginated->getList()->toArray(); |
|
| 137 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Railroad Station, Stockdale, Texas]", $results[0]->Title); |
|
| 138 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Railroad Station, Taft, Texas]", $results[1]->Title); |
|
| 139 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Railroad Station, Sierra Blanca, Texas]", $results[2]->Title); |
|
| 140 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Freight Station, Waxahachie, Texas]", $results[3]->Title); |
|
| 141 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Passenger Station, Waxahachie, Texas]", $results[4]->Title); |
|
| 142 | $this->assertEquals("[Texas and New Orleans, Southern Pacific, Tower No. 63, Mexia, Texas]", $results[5]->Title); |
|
| 143 | $this->assertEquals("[Texas and New Orleans, Southern Pacific, Eakin Street Yard Office, Dallas, Texas]", $results[6]->Title); |
|
| 144 | $this->assertEquals("[Texas and New Orleans, Southern Pacific Locomotive Scrap Line, Englewood Yards, Houston, Texas]", $results[7]->Title); |
|
| 145 | $this->assertEquals("[Texas and New Orleans, Southern Pacific, Switchman's Tower, San Antonio, Texas]", $results[8]->Title); |
|
| 146 | $this->assertEquals("Flash Light view in new Subterranean", $results[9]->Title); |
|
| 147 | } |
|
| 148 | ||
| 149 | ||
| 150 | // if this is not set to unbounded, zero, a conditional is triggered to add max doc freq to the request |
|