# Search DSL

# Search DSL

Curiosity Workspace search can be used via UI components and APIs. This page documents the common request shape and mental model for building search experiences programmatically.

# Search request concepts

Most search requests specify:

  • Query text: what the user typed
  • Type scope: which node types are eligible results
  • Filters/facets: property facets and related facets
  • Target set (optional): restrict search to a set of nodes (often computed by a graph query)
  • Sort mode: relevance, recency, or a domain-specific ordering
  • Hybrid settings (optional): how keyword and vector retrieval combine

# Minimal search request (conceptual)

var request = SearchRequest.For("MacBook Air");
request.BeforeTypesFacet = new([] { "SupportCase", "Device", "Part" });

var query = await Graph.CreateSearchAsync(request);
return query.Emit();

# Target-set constrained search (graph + search)

This pattern is key to “search within context”.

var request = SearchRequest.For("screen flicker");
request.BeforeTypesFacet = new([] { "SupportCase" });

// Restrict search to nodes returned by a graph traversal (example: all items for a manufacturer)
request.TargetUIDs = Q().StartAt("Manufacturer", "Apple").Out().AsUIDEnumerable().ToArray();

var query = await Graph.CreateSearchAsync(request);
return query.Emit();

# Semantic / embedding search (conceptual)

If embedding indexes are enabled, similarity search can be used as a standalone retrieval method or as part of hybrid ranking.

return Q().StartAtSimilarText("Apple screen issue", nodeTypes: new[] { "SupportCase" })
          .EmitWithScores();

# Best practices

  • Explicit type scope: always constrain to the relevant types for the user experience.
  • Use facets: facets are the primary UX mechanism to reduce result sets.
  • Prefer context constraints: compute a target set using graph traversal and pass it into search.
  • Evaluate changes: changes to boosts, cutoffs, and hybrid logic should be tested with a query set.

# Related pages