***

title: search_direct
slug: /reference/python/agents/search/search-service/search-direct
description: Perform a search programmatically without going through the HTTP API.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Perform a search programmatically without going through the HTTP API.
This is useful for embedding search in application code where you want
the full preprocessing pipeline but do not need network overhead.

## **Parameters**

<ParamField path="query" type="str" required={true} toc={true}>
  The search query text.
</ParamField>

<ParamField path="index_name" type="str" default="default" toc={true}>
  Name of the index to search.
</ParamField>

<ParamField path="count" type="int" default="3" toc={true}>
  Maximum number of results to return.
</ParamField>

<ParamField path="distance" type="float" default="0.0" toc={true}>
  Minimum similarity threshold for results.
</ParamField>

<ParamField path="tags" type="Optional[list[str]]" toc={true}>
  Filter results by tags.
</ParamField>

<ParamField path="language" type="Optional[str]" toc={true}>
  Language code for query processing, or `None` for auto-detection.
</ParamField>

## **Returns**

`dict[str, Any]` -- A dictionary with:

* `results` (list) -- list of result dicts, each with `content`, `score`, and `metadata`
* `query_analysis` (dict) -- information about query preprocessing

## **Example**

```python {4}
from signalwire.search import SearchService

service = SearchService(indexes={"docs": "./docs.swsearch"})
response = service.search_direct(
    query="How do I set up an agent?",
    index_name="docs",
    count=5,
)

for result in response["results"]:
    print(f"[{result['score']:.3f}] {result['content'][:100]}")
```