| 
                                
                                    @@ 85-96 (lines=12) @@
                                 | 
                            
                                                            
                                    | 82 | 
                                     | 
                                     | 
                                
                                                            
                                    | 83 | 
                                     | 
                                     | 
                                
                                                            
                                    | 84 | 
                                     | 
                                     | 
                                
                                                            
                                    | 85 | 
                                     | 
                                    	public function testSimilarNoWeighting() { | 
                                
                                                            
                                    | 86 | 
                                     | 
                                    		$fp = $this->objFromFixture('FlickrPhotoTO', 'photo0076'); | 
                                
                                                            
                                    | 87 | 
                                     | 
                                    		$es = new ElasticSearcher();  | 
                                
                                                            
                                    | 88 | 
                                     | 
                                    		$es->setClasses('FlickrPhotoTO'); | 
                                
                                                            
                                    | 89 | 
                                     | 
                                    		$fields = array('Title.standard', 'Description.standard'); | 
                                
                                                            
                                    | 90 | 
                                     | 
                                    		try { | 
                                
                                                            
                                    | 91 | 
                                     | 
                                    			$paginated = $es->moreLikeThis($fp, $fields, true);  | 
                                
                                                            
                                    | 92 | 
                                     | 
                                    			$this->fail('Query has no weight and thus should have failed'); | 
                                
                                                            
                                    | 93 | 
                                     | 
                                    		} catch (InvalidArgumentException $e) { | 
                                
                                                            
                                    | 94 | 
                                     | 
                                    			$this->assertEquals('Fields must be of the form fieldname => weight', $e->getMessage()); | 
                                
                                                            
                                    | 95 | 
                                     | 
                                    		}  | 
                                
                                                            
                                    | 96 | 
                                     | 
                                    	}  | 
                                
                                                            
                                    | 97 | 
                                     | 
                                     | 
                                
                                                            
                                    | 98 | 
                                     | 
                                     | 
                                
                                                            
                                    | 99 | 
                                     | 
                                    	public function testSimilarWeightingNotNumeric() { | 
                                
                                                                                
                                 | 
                                
                                    @@ 99-110 (lines=12) @@
                                 | 
                            
                                                            
                                    | 96 | 
                                     | 
                                    	}  | 
                                
                                                            
                                    | 97 | 
                                     | 
                                     | 
                                
                                                            
                                    | 98 | 
                                     | 
                                     | 
                                
                                                            
                                    | 99 | 
                                     | 
                                    	public function testSimilarWeightingNotNumeric() { | 
                                
                                                            
                                    | 100 | 
                                     | 
                                    		$fp = $this->objFromFixture('FlickrPhotoTO', 'photo0076'); | 
                                
                                                            
                                    | 101 | 
                                     | 
                                    		$es = new ElasticSearcher();  | 
                                
                                                            
                                    | 102 | 
                                     | 
                                    		$es->setClasses('FlickrPhotoTO'); | 
                                
                                                            
                                    | 103 | 
                                     | 
                                    		$fields = array('Title.standard' => 4, 'Description.standard' => 'not numeric'); | 
                                
                                                            
                                    | 104 | 
                                     | 
                                    		try { | 
                                
                                                            
                                    | 105 | 
                                     | 
                                    			$paginated = $es->moreLikeThis($fp, $fields, true);  | 
                                
                                                            
                                    | 106 | 
                                     | 
                                    			$this->fail('Query has non numeric weight and thus should have failed'); | 
                                
                                                            
                                    | 107 | 
                                     | 
                                    		} catch (InvalidArgumentException $e) { | 
                                
                                                            
                                    | 108 | 
                                     | 
                                    			$this->assertEquals('Fields must be of the form fieldname => weight', $e->getMessage()); | 
                                
                                                            
                                    | 109 | 
                                     | 
                                    		}  | 
                                
                                                            
                                    | 110 | 
                                     | 
                                    	}  | 
                                
                                                            
                                    | 111 | 
                                     | 
                                     | 
                                
                                                            
                                    | 112 | 
                                     | 
                                     | 
                                
                                                            
                                    | 113 | 
                                     | 
                                    	public function testSimilarToNonSearchable() { | 
                                
                                                                                
                                 | 
                                
                                    @@ 113-124 (lines=12) @@
                                 | 
                            
                                                            
                                    | 110 | 
                                     | 
                                    	}  | 
                                
                                                            
                                    | 111 | 
                                     | 
                                     | 
                                
                                                            
                                    | 112 | 
                                     | 
                                     | 
                                
                                                            
                                    | 113 | 
                                     | 
                                    	public function testSimilarToNonSearchable() { | 
                                
                                                            
                                    | 114 | 
                                     | 
                                    		$m = Member::get()->first(); // this is not by default Searchable  | 
                                
                                                            
                                    | 115 | 
                                     | 
                                    		$es = new ElasticSearcher();  | 
                                
                                                            
                                    | 116 | 
                                     | 
                                    		$es->setClasses('FlickrPhotoTO'); | 
                                
                                                            
                                    | 117 | 
                                     | 
                                    		$fields = array('Title.standard' => 4, 'Description.standard' => 2); | 
                                
                                                            
                                    | 118 | 
                                     | 
                                    		try { | 
                                
                                                            
                                    | 119 | 
                                     | 
                                    			$paginated = $es->moreLikeThis($m, $fields, true);  | 
                                
                                                            
                                    | 120 | 
                                     | 
                                    			$this->fail('Querying for a non searchable object, thus should have failed'); | 
                                
                                                            
                                    | 121 | 
                                     | 
                                    		} catch (InvalidArgumentException $e) { | 
                                
                                                            
                                    | 122 | 
                                     | 
                                    			$this->assertEquals('Objects of class Member are not searchable', $e->getMessage()); | 
                                
                                                            
                                    | 123 | 
                                     | 
                                    		}  | 
                                
                                                            
                                    | 124 | 
                                     | 
                                    	}  | 
                                
                                                            
                                    | 125 | 
                                     | 
                                     | 
                                
                                                            
                                    | 126 | 
                                     | 
                                    	public function testSimilarGood() { | 
                                
                                                            
                                    | 127 | 
                                     | 
                                    		$fp = $this->objFromFixture('FlickrPhotoTO', 'photo0076'); |