File tree 3 files changed +15
-2
lines changed
test/lib/Elastica/Test/Query
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
CHANGES
2
2
3
+ 2014-07-07
4
+ - Fix FunstionScore Query random_score without seed bug. #647
5
+
3
6
2014-07-02
4
7
- Add setPostFilter method to Elastica\Query (http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_filtering_queries_and_aggregations.html#_post_filter) #645
5
8
Original file line number Diff line number Diff line change @@ -171,9 +171,9 @@ public function setBoostMode($mode)
171
171
*/
172
172
public function setRandomScore ($ seed = NULL )
173
173
{
174
- $ seedParam = array ();
174
+ $ seedParam = new \ stdClass ();
175
175
if (!is_null ($ seed )) {
176
- $ seedParam[ ' seed ' ] = $ seed ;
176
+ $ seedParam-> seed = $ seed ;
177
177
}
178
178
return $ this ->setParam ('random_score ' , $ seedParam );
179
179
}
Original file line number Diff line number Diff line change @@ -170,6 +170,16 @@ public function testRandomScore()
170
170
$ this ->assertEquals ("Miller's Field " , $ result0 ['name ' ]);
171
171
}
172
172
173
+ public function testRandomScoreWithoutSeed ()
174
+ {
175
+ $ query = new FunctionScore ();
176
+ $ query ->setRandomScore ();
177
+
178
+ $ response = $ this ->type ->search ($ query );
179
+
180
+ $ this ->assertEquals (2 , $ response ->count ());
181
+ }
182
+
173
183
public function testScriptScore ()
174
184
{
175
185
$ scriptString = "_score * doc['price'].value " ;
You can’t perform that action at this time.
0 commit comments