Skip to main content

Search Scoped to a Single Space

Plain search(query: ...) is global across every space in Geo. Most of the time you actually want "find this within my target space" — for dedup, for name resolution, for autocomplete. The pattern below uses entities with both a name filter and a space filter.

Query

query ScopedSearch($needle: String!, $spaceId: UUID!) {
entities(
first: 10
filter: {
name: { includesInsensitive: $needle }
spaceIds: { anyEqualTo: $spaceId }
}
) {
id
name
types { id name }
}
}
{
"needle": "diffusion",
"spaceId": "41e851610e13a19441c4d980f2f2ce6b"
}

Response

{
"data": {
"entities": [
{ "id": "0beb975d1a6c4d93bd163e01f6d7eeda", "name": "Denoising Diffusion Probabilistic Models" },
{ "id": "11fa93dfea8b4f78a27b541c6e97de85", "name": "High-Resolution Image Synthesis with Latent Diffusion Models (Stable Diffusion) cover" },
{ "id": "153b24f39ac74d8983d93d71a8eae0d0", "name": "Diffusion Beats GANs on Image Synthesis (ADM) avatar" }
]
}
}
Loading interactive query runner…

Scoping by space + type

The combo most curators want — "find a Project in this space whose name contains X":

query ScopedTypedSearch($needle: String!, $spaceId: UUID!, $typeId: UUID!) {
entities(
first: 10
filter: {
name: { includesInsensitive: $needle }
spaceIds: { anyEqualTo: $spaceId }
typeIds: { anyEqualTo: $typeId }
}
) {
id
name
}
}

When to use which

GoalUse
"Find an entity called something like X across all of Geo"Plain search(query: $q) (global, fuzzy, untyped)
"Find an entity exactly called X anywhere"entities(filter: { name: { is: $q } })
"Find an entity called something like X in my space"entities(filter: { name: { includesInsensitive: $q }, spaceIds: { anyEqualTo: $spaceId } }) ← this recipe
"Find a Project in my space called something like X"Same as above, plus typeIds: { anyEqualTo: $typeId }

Notes

  • includesInsensitive is case-insensitive substring match"diffusion" matches "Diffusion Beats GANs" and "Stable Diffusion WebUI". Returns no relevance ranking — results are in storage order.
  • spaceIds: { anyEqualTo } matches if the entity has at least one published value or relation in that space. An entity can live in many spaces; this filter says "this space is one of them".
  • Avoid empty needle — an empty string matches every entity in the space (includesInsensitive: "") and the response will be huge. Validate input client-side.
  • Combine with OrderBy for deterministic pagination: entitiesConnection(... orderBy: NAME_ASC). Without an explicit order, page boundaries can shift between requests.