> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcore.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Types

> The 6 query types the CORE search router classifies every query into, and what each handler returns.

## How classification works

The CORE search router (`apps/webapp/app/services/search-v2/router.ts`) classifies every incoming query into one of 6 query types and dispatches it to a dedicated handler. Classification uses vector search on the `LABEL` namespace to find matched labels, plus LLM aspect extraction to identify aspect intent. The router also returns `shouldSearch: boolean` to skip search entirely when appropriate. See `how-core-searches` for the full pipeline.

## The 6 query types

### aspect\_query

Trigger: the user wants facts of a specific aspect type (preferences, decisions, directives, goals, and similar).

Example queries:

* "What are my coding preferences?"
* "Show my decisions about auth"
* "What directives have I set for code review?"

Router fills `aspects: string[]` with the matched aspect enum values. Handler `handleAspectQuery` runs graph traversal scoped by matched labels and aspects, plus entity-hint resolution and vector fallback. Returns statements grouped by aspect.

### entity\_lookup

Trigger: the user wants information about a specific named entity. Router sets `lookupMode` to one of two values:

* `attribute`: the query asks for a specific field of the entity. Router sets `attributeHint` (for example `"phone"`, `"email"`, `"team"`). Examples: "What is John's phone number?", "Sarah's email?". Handler returns the entity node with that attribute.
* `broad`: the query asks generally about the entity. Examples: "Who is Sarah?", "Tell me about X", "anything about airbnb email". Handler returns episodes where the entity appears.

Example queries:

* "What is John's phone number?" (`attribute`, `attributeHint: "phone"`)
* "Who is Sarah?" (`broad`)
* "Anything about the airbnb email?" (`broad`)

In both modes, entity hints are resolved via vector search on the `ENTITY` namespace before traversal.

### temporal

Trigger: the query is bounded by time.

Example queries:

* "What happened last week?"
* "What did we decide yesterday?"
* "Show my work from January"

Router fills `temporal: { type: "recent" | "range" | "before" | "after" | "all", days, startDate, endDate }`. Handler `handleTemporal` runs label-plus-time graph traversal, the entity-hint path, and vector fallback in parallel. Returns episodes within the time bound.

### temporal\_facets

Trigger: the user wants aggregates over a time range, not specific episodes.

Example queries:

* "What topics did I speak about last week?"
* "Who are the people I spoke about this month?"
* "What decisions and goals came up last month?"

Router fills `facets: ("topics" | "entities" | "aspects")[]` along with the temporal bounds. Handler returns counts grouped by facet, not episodes.

### exploratory

Trigger: broad topic queries with no specific entity, aspect, or time anchor.

Example queries:

* "Search implementation in CORE"
* "Authentication architecture"
* "Catch me up on recent work"

Handler queries compacted session documents scoped by matched labels, plus the entity-hint path and vector fallback. Returns session summaries and related statements.

### relationship

Trigger: a connection between 2 or more entities. Requires at least 2 entity hints.

Example queries:

* "How do I know Sarah?"
* "How is the payment service related to Stripe?"
* "What is the connection between TypeScript and CORE?"

Handler resolves each entity hint via vector search on the `ENTITY` namespace, then performs graph traversal for statements connecting them. Returns the connecting statements.

## When no search runs

The router can decide `shouldSearch: false` for greetings or unrelated chat (for example "Hello!" or "What's the weather?"). When this happens, the search pipeline short-circuits and returns empty without dispatching to any handler.

## Related

* `how-core-searches`: the full search pipeline that wraps this router.
* `aspects`: the aspect enum values used by `aspect_query` and `temporal_facets`.
* `entity_types`: the entity kinds resolved during `entity_lookup` and `relationship`.
* `labels`: the `LABEL` namespace used during classification.
