Skip to content

Commit 601c877

Browse files
committed
commit
1 parent 9a66254 commit 601c877

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

app/base/tools/Search/Manager.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,20 @@ public function flush() : array
9494
]);
9595
}
9696

97-
public function countAll() : int
97+
public function countAll($query = '*') : int
9898
{
99+
if (is_string($query)) {
100+
$query = [
101+
"query_string" => [
102+
"query" => $query,
103+
],
104+
];
105+
}
106+
99107
return $this->getClient()->count([
100108
'index' => self::INDEX_NAME,
101109
'body' => [
102-
"query" => [
103-
"query_string" => [
104-
"query" => "*",
105-
],
106-
],
110+
"query" => $query,
107111
],
108112
])['count'];
109113
}

0 commit comments

Comments
 (0)