Search R2R

Perform a search query against vector and/or graph-based databases.

Search Modes:

  • basic: Defaults to semantic search. Simple and easy to use.
  • advanced: Combines semantic search with full-text search for more comprehensive results.
  • custom: Complete control over how search is performed. Provide a full SearchSettings object.

Filters: Apply filters directly inside search_settings.filters. For example:

1{
2"filters": {"document_id": {"$eq": "e43864f5-a36f-548e-aacd-6f8d48b30c7f"}}
3}

Supported operators: $eq, $neq, $gt, $gte, $lt, $lte, $like, $ilike, $in, $nin.

Hybrid Search: Enable hybrid search by setting use_hybrid_search: true in search_settings. This combines semantic search with keyword-based search for improved results. Configure with hybrid_settings:

1{
2"use_hybrid_search": true,
3"hybrid_settings": {
4 "full_text_weight": 1.0,
5 "semantic_weight": 5.0,
6 "full_text_limit": 200,
7 "rrf_k": 50
8}
9}

Graph-Enhanced Search: Knowledge graph integration is enabled by default. Control with graph_search_settings:

1{
2"graph_search_settings": {
3 "use_graph_search": true,
4 "kg_search_type": "local"
5}
6}

Advanced Filtering: Use complex filters to narrow down results by metadata fields or document properties:

1{
2"filters": {
3 "$and":[
4 {"document_type": {"$eq": "pdf"}},
5 {"metadata.year": {"$gt": 2020}}
6 ]
7}
8}

Results: The response includes vector search results and optional graph search results. Each result contains the matched text, document ID, and relevance score.

Headers

AuthorizationstringRequired

Bearer authentication of the form Bearer <token>, where token is your auth token.

X-API-KeystringRequired

Request

This endpoint expects an object.
querystringRequired

Search query to find relevant documents

search_modeenumOptional

Default value of custom allows full control over search settings.

Pre-configured search modes: basic: A simple semantic-based search. advanced: A more powerful hybrid search combining semantic and full-text. custom: Full control via search_settings.

If filters or limit are provided alongside basic or advanced, they will override the default settings for that mode.

Allowed values:
search_settingsobjectOptional

The search configuration object. If search_mode is custom, these settings are used as-is. For basic or advanced, these settings will override the default mode configuration.

Common overrides include filters to narrow results and limit to control how many results are returned.

Response

Successful Response

resultsobject

Result of an aggregate search operation.

Errors