> For the complete documentation index, see [llms.txt](https://docs.hyper-space.io/hyperspace-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyper-space.io/hyperspace-docs/api-documentation/hyperspace-client/search.md).

# search

The function `search(query_schema, size, function_name, collection_name)` runs search queries inside a collection.

**Input**

* <mark style="color:purple;">query\_schema</mark> – Specifies the document for the query schema object.
* <mark style="color:purple;">size</mark> – Specifies the number of results to return.
* <mark style="color:purple;">function\_name</mark> – Specifies the scoring function to be used in the Classic Search query, as described in Step 1, Creating the Scoring Function.
* <mark style="color:purple;">collection\_name</mark> – Specifies the Collection in which to search.
* <mark style="color:purple;">fields (optional)</mark> – Specifies the document fields to be returned with each result.

**Example**&#x20;

{% tabs %}
{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
params= {
         "name": "John"
        }
results = hyperspace_client.search(params,
                                   size=10,                 
                                   collection_name=collection_name
                                   function_name='score_function')
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
int size = 10;
String params= "{" +
    "\"name\": \"John\""+
    "}";
String functionName = "score_function";
await hyperspaceClient.search(collectionName, size, params, functionName);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```python
let size = 10;
let params= {
    "name": "John"
}
let functionName = 'score_function';
await hyperspaceClient.search(collectionName, size, params, functionName);
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Response**

A list of candidates, as shown in the example below

{ "candidates": 1, "similarity": \[ { "document\_id": "29", "score": 10.0, "fields": { "FirstSeenTime": 1506116398, "City": "Jakarta" } } ], "took\_ms": 33.625 }
