# Searches API > Given a query and a set of documents or labels, the model ranks each document based on its semantic similarity to the provided query. > > https://beta.openai.com/docs/api-reference/searches Searching across a large collection of smaller documents is quite easy with GPT-3. ```php use SiteOrigin\OpenAI\Client; use SiteOrigin\OpenAI\Engines; $documents = [ "White House", "hospital", "school", ]; $client = new Client($_ENV['OPENAI_API_KEY']); $result = $client->search(Engines::ADA)->search('President', $documents); ``` Where the value of `$result` would be ```php (object) array( 'object' => 'list', 'data' => array ( 0 => (object) array( 'object' => 'search_result', 'document' => 0, 'score' => 391.496, ), 1 => (object) array( 'object' => 'search_result', 'document' => 1, 'score' => -113.686, ), 2 => (object) array( 'object' => 'search_result', 'document' => 2, 'score' => -75.336, ), ), 'model' => 'ada:2020-05-03', ); ``` Or you can upload a file, to have it preprocessed. ```php use SiteOrigin\OpenAI\Client; use SiteOrigin\OpenAI\Engines; use SiteOrigin\OpenAI\Files; $documents = [ ["text" => "White House", "metadata" => "document 1"], ["text" => "hospital", "metadata" => "document 2"], ["text" => "school", "metadata" => "document 3"], ]; $client = new Client($_ENV['OPENAI_API_KEY']); $file = $client->files()->create('data.json', $documents, Files::PURPOSE_SEARCH); // Wait for the file to process $result = $client->search(Engines::ADA)->search('President', $file->id); ```