Skip to content

Commit

Permalink
Fix limit test (#149)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Sergeev <[email protected]>
  • Loading branch information
aivchen and Nick-S-2018 authored Jan 12, 2024
1 parent 4dd0bb4 commit cbd9bd9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/Manticoresearch/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,20 @@ public function testFilterIn()
$results = static::$search->filter('year', 'in', [1960,1979,1986])->get();
$this->assertEquals([1979,1986], $this->yearsFromResults($results, 'sort'));
}

/**
* Demonstrate that the array of years gets smaller for the same phrase match as the limit is applied
*/
public function testLimitMethod()
{
$results = static::$search->limit(3)->phrase('team of explorers')->get();
$this->assertEquals([1986,2014,1992], $this->yearsFromResults($results));
self::assertCount(3, $results);

$results = static::$search->limit(2)->phrase('team of explorers')->get();
$this->assertEquals([1986,2014], $this->yearsFromResults($results));
self::assertCount(2, $results);

$results = static::$search->limit(1)->phrase('team of explorers')->get();
$this->assertEquals([1986], $this->yearsFromResults($results));
self::assertCount(1, $results);
}

/**
Expand Down Expand Up @@ -263,7 +263,7 @@ public function testNotFilterRange()
$results = static::$search->notFilter('year', 'range', [1900,1990])->get();
$this->assertEquals([1992,2010,2014,2018], $this->yearsFromResults($results, 'sort'));
}

public function testNotFilterIn()
{
$results = static::$search->notFilter('year', 'in', [1960,1979,1986])->get();
Expand Down Expand Up @@ -774,7 +774,7 @@ public function testTrackScores()
$this->assertGreaterThan(1, $resultHit->getScore());
}
}

public function testStripBadUtf8Compiles()
{
$body = static::$search->stripBadUtf8(true)->compile();
Expand Down

0 comments on commit cbd9bd9

Please sign in to comment.