alpha new hybridretriver line
This commit is contained in:
@@ -25,17 +25,47 @@ final class VectorSearchClient
|
||||
$this->agentLogger = $agentLogger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard global search
|
||||
*/
|
||||
public function search(string $query, int $limit = 5): array
|
||||
{
|
||||
return $this->executeSearch([
|
||||
'query' => $query,
|
||||
'limit' => $limit,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scoped search: nur innerhalb bestimmter Dokumente
|
||||
*/
|
||||
public function searchScoped(
|
||||
string $query,
|
||||
int $limit,
|
||||
array $docIds
|
||||
): array {
|
||||
if ($docIds === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->executeSearch([
|
||||
'query' => $query,
|
||||
'limit' => $limit,
|
||||
'doc_ids' => array_values($docIds),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gemeinsame HTTP-Logik (keine Duplikation)
|
||||
*/
|
||||
private function executeSearch(array $payload): array
|
||||
{
|
||||
try {
|
||||
$response = $this->http->request(
|
||||
'POST',
|
||||
$this->serviceUrl . '/search-chunks',
|
||||
[
|
||||
'json' => [
|
||||
'query' => $query,
|
||||
'limit' => $limit,
|
||||
],
|
||||
'json' => $payload,
|
||||
'timeout' => 10,
|
||||
]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user