Skip to content

Commit

Permalink
支持批量搜索
Browse files Browse the repository at this point in the history
  • Loading branch information
查伟昌 committed Nov 29, 2023
1 parent 109bd8b commit 6f4d991
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/Exception/UnknownException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* ServerException
*
* @since Mar 2023
* @author Haydar KULEKCI <[email protected]>
*/

namespace Qdrant\Exception;

use Qdrant\Response;
use RuntimeException;

class UnknownException extends RuntimeException
{
protected Response $response;

/**
* @return Response
*/
public function getResponse(): Response
{
return $this->response;
}

/**
* @param Response $response
* @return ServerException
*/
public function setResponse(Response $response): UnknowException
{
$this->response = $response;

return $this;
}
}
30 changes: 30 additions & 0 deletions src/Models/Request/SearchBatchRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* SearchParams
*
* @since Mar 2023
* @author Haydar KULEKCI <[email protected]>
*/
namespace Qdrant\Models\Request;

use Qdrant\Exception\InvalidArgumentException;
use Qdrant\Models\Filter\Filter;
use Qdrant\Models\PointStruct;
use Qdrant\Models\Traits\ProtectedPropertyAccessor;
use Qdrant\Models\VectorStruct;
use Qdrant\Models\VectorStructInterface;

class SearchBatchRequest
{
protected array $batchSearch = [];

public function addSearch(SearchRequest $search): void
{
$this->batchSearch[] = $search->toArray();
}

public function toArray(): array
{
return ['searches' => $this->batchSearch];
}
}

1 comment on commit 6f4d991

@hkulekci
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @zwell, I see your contribution here for BatchRequest. Would you mind sending these changes to the hkulekci/qdrant-php repository as a PR if you test this use case? It would be perfect if we could do that.

Please sign in to comment.