# Custom Queries and Graph Search

# Custom Queries and Graph Search

Beyond basic keyword search, Curiosity Workspace supports complex graph-based queries that combine structural traversals with full-text and semantic retrieval.

# Complex Graph Queries

# Path Queries

Find connections between nodes across multiple edges.

{
  "start": "node_a",
  "path": [
    { "edge": "works_at", "direction": "outbound" },
    { "edge": "located_in", "direction": "outbound" }
  ]
}

# Shortest Path

Identify the most direct link between two entities. This is useful for relationship discovery and fraud detection.

{
  "type": "shortest_path",
  "from": "node_id_1",
  "to": "node_id_2",
  "max_depth": 5
}

# Combining Graph and Text Search

You can constrain a full-text search to a specific neighborhood in the graph.

Example: Search for "security" only within documents linked to "Project X".

{
  "query": "security",
  "graph_constraint": {
    "start": "project_x_id",
    "edge": "contains_doc",
    "direction": "outbound"
  }
}

# Advanced Semantic Retrieval

Combine semantic similarity (vector search) with graph properties to find "similar items in the same category".

{
  "vector_search": {
    "query": "cloud computing",
    "field": "description_vector"
  },
  "filters": [
    { "type": "node_property", "key": "category", "value": "whitepaper" }
  ]
}

# Performance Considerations

  • Depth Limits: Always specify a max_depth for path queries to prevent performance degradation on highly connected graphs.
  • Filtering Early: Apply property filters as early as possible in your query to reduce the search space.
  • Index Usage: Ensure that fields used in query filters are properly indexed.

# Next Steps