search_direct

View as MarkdownOpen in Claude

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

query
strRequired

The search query text.

index_name
strDefaults to default

Name of the index to search.

count
intDefaults to 3

Maximum number of results to return.

distance
floatDefaults to 0.0

Minimum similarity threshold for results.

tags
Optional[list[str]]

Filter results by tags.

language
Optional[str]

Language code for query processing, or None for auto-detection.

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

1from signalwire.search import SearchService
2
3service = SearchService(indexes={"docs": "./docs.swsearch"})
4response = service.search_direct(
5 query="How do I set up an agent?",
6 index_name="docs",
7 count=5,
8)
9
10for result in response["results"]:
11 print(f"[{result['score']:.3f}] {result['content'][:100]}")