Skip to content

Commit

Permalink
fixes an error when searching without params
Browse files Browse the repository at this point in the history
  • Loading branch information
Анастасия Скульская committed Dec 10, 2024
1 parent bf8622d commit 487e165
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Manticoresearch/Query/BoolQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public function should($args):self {
return $this;
}
public function toArray() {
return $this->convertArray(['bool' => $this->params]);
if (!empty($this->params)) {
return $this->convertArray(['bool' => $this->params]);
}
return null;
}
}
2 changes: 1 addition & 1 deletion test/Manticoresearch/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function setUp() : void {
}

public function testNoParams() {
$this->assertEquals([], $this->query->toArray());
$this->assertEquals(null, $this->query->toArray());
}

public function testParamsNoNesting() {
Expand Down

0 comments on commit 487e165

Please sign in to comment.