
Calling the Search API
All search goes through SearchRequest. Build a request, call the right method, iterate results.
Basic hybrid search:
var search = SearchRequest.For("battery drain overnight");
search.BeforeTypesFacet = new(["Ticket"]); // limit to one node type
search.Take = 10;
// System context (admin/ingestion): no ACL enforcement
var results = await Graph.CreateSearchAsync(search, CancellationToken);
// User context: ACL filter applied before ranking
var results = await Graph.CreateSearchAsUserAsync(search, CurrentUser, CancellationToken);
foreach (var node in results.Take(10))
{
var title = node.GetString("Subject");
var snippet = Graph.GetIndexedText(node.UID, maxChars: 500);
}
Scoping to a graph neighbourhood:
// Only tickets for a specific product
search.TargetUIDs = Q().StartAt("Product", "MBA-2024")
.In("ForProduct")
.AsUIDEnumerable()
.ToArray();
Always use CreateSearchAsUserAsync in user-facing endpoints and AI tools. It enforces the calling user's permissions automatically.