client.search(...) and gets
back the right answer.
The basics
How routing works
Memic classifies every query along one axis: semantic or structured.- Semantic queries — natural-language questions best answered from document content (“what is our refund policy”, “summarize Q3 earnings”, “how do I reset my password”). These hit the semantic index over your uploaded files.
- Structured queries — filters, aggregations, lookups, or anything that reads more like a database query (“orders from Q3 2025 over $500”, “customers in the Enterprise tier”, “open tickets assigned to me”). These hit connectors you’ve attached to the environment (Postgres, Notion, Google Sheets, Salesforce, custom connectors).
routing field on every response shows exactly which path was taken
and why:
route: "structured", a non-null
connector_id, and the results in results.structured instead of
results.semantic.
Response shape
semantic and structured are present on every response — one will
be populated, the other will be null. Your agent code can inspect
routing.route to decide how to format the answer.
When to use which
You don’t normally pick. Memic picks for you based on the query. But if you want to influence routing, the easiest lever is phrasing:- Push toward semantic: use natural-language phrasing. “What does our refund policy say about digital products?”
- Push toward structured: use explicit filters and comparisons. “Orders from 2025 where total > $500 in the eu-west region”
Tuning top_k
top_k controls how many results come back. Defaults:
- Default:
5 - For RAG prompts feeding an LLM:
5–10 - For search UIs with a ranked list:
20–50
Filtering
Scope searches to specific folders or file types via thefilters field:
Debugging results
If search isn’t returning what you expect:- Check the routing. Did Memic take the route you expected? If a
natural-language query got routed to
structured, rephrase it to be less filter-like. If a filter query got routed tosemantic, be more explicit about the comparison. - Verify the file is
ready.GET /files/{id}/status. If it’s stillprocessing, passages aren’t indexed yet. - Inspect
total_results. If it’s0, no content matched. Try a broader query or verify the content is in the right environment. - Confirm the environment.
GET /mereturns which environment your key is bound to. If it’s not the one your files live in, swap keys. - Check connectors. If you expected a structured result and got nothing, verify the connector is attached and synced in the dashboard.
Related
Chat guide
Use search results to power grounded LLM answers.
API reference
Full search endpoint reference.