ANSWERS · ANSWERS FOR CODING AGENTS

What is semantic code search?

AUTHOR · XERJ documentation team · REVIEWED BY · XERJ engineering team · PUBLISHED · 2026-11-13 · UPDATED · 2026-11-14
SHORT ANSWER · UPDATED 2026-11-14

What is semantic code search? It ranks source passages by meaning, not only by the exact words in the query. On XERJ you can also look up definitions with syntax-aware search, which uses tree-sitter across 36 languages, or fuse both rankings with hybrid search. The default embedding mode is lexical, not neural.

Key number: XERJ covers 36 languages via tree-sitter, pinned by a unit test. A file over 2 MiB is skipped, at most 5,000 symbols per file, and names over 200 bytes are dropped. There is no call graph. (as of 2026-11-13 · source: landing/science/syntax-aware-search.html)

TL;DR Semantic code search ranks source by meaning, not only by exact words. Use it when you can describe the behaviour but do not know the symbol name. XERJ also offers syntax-aware definitions through tree-sitter in 36 languages, and hybrid search that fuses a full-text ranking with a semantic or vector ranking. The default embedding mode is lexical, not neural.

Try it: three ways to search code

Meaning, names, or both

Rank passages by meaning

This mode ranks passages that share meaning with the query, not only the same words. On a XERJ node the default embedding mode is lexical, not neural. Start the node with --embed-mode neural when you want the built-in neural embedder.

Language count and caps are the published syntax-aware figures. On a XERJ node the default embedding mode is lexical, not neural. Start the node with --embed-mode neural when you want the built-in neural embedder.
PASTE THIS TO YOUR AI AGENT — IT DOES THE REST Act as a coding agent. Read https://xerj.org/llms.txt, start a node with `xerj --insecure --data-dir ./.xerj-data`, index the repository with `xerj autoindex . --url http://127.0.0.1:9200 --progress plain`, then use `xerj def` when you know the symbol name and `xerj search` when you only have a description. Cite file:line. If the node was not started with --embed-mode neural, say that the default embedding mode is lexical.
RUN THIS XERJ COMMAND curl -fsSL https://xerj.org/get | sh Install the release binary into ~/.local/bin.
RUN THIS XERJ COMMAND xerj --insecure --data-dir ./.xerj-data Start a local development node. Default embedding mode is lexical, not neural.
RUN THIS XERJ COMMAND xerj autoindex . --url http://127.0.0.1:9200 --progress plain Index the repository, including definitions tree-sitter can parse.
RUN THIS XERJ COMMAND xerj def "BuiltinPager" Go to a definition by name, with file:line and a signature.
RUN THIS XERJ COMMAND xerj search "how is pagination implemented" Ranked passages when you can describe the behaviour but not the symbol.

Meaning, not only words

Semantic code search ranks passages that share meaning with the query. A question like "how is pagination implemented" can surface a function whose name you did not type. Exact-string search cannot do that job well, unless the identifier is already in the query. On a XERJ node the default embedding mode is lexical, not neural. Start the node with --embed-mode neural when you want the built-in neural embedder.

The concept, outside of code, is What is semantic search?. How it sits next to vector search and hybrid search is Hybrid search, vector search, or semantic search?.

On a XERJ node the default embedding mode is lexical, not neural. Semantic queries still run in that mode, as word and sub-word overlap plus BM25. Start the node with --embed-mode neural when you want the built-in neural embedder.

Syntax-aware lookup, when you know the name

When you already know the symbol, go to the definition. XERJ does this with syntax-aware search, through tree-sitter, in 36 languages. A file over 2 MiB is skipped, at most 5,000 symbols per file, and names over 200 bytes are dropped. There is no call graph. xerj def is the CLI for that path.

Hybrid, when the query is mixed

Many real queries mix a name and a description. Hybrid search fuses a full-text ranking such as BM25 with a semantic or vector ranking, often with reciprocal rank fusion. That is usually the better default when you are not sure which words the source uses. On a XERJ node the default embedding mode is lexical, not neural.

Tools and GitHub checkouts

An agent can call the same index through the MCP server. A comparison of local code search MCP tools, checked 2026-10-19, is Best code search MCP tools, tested.

To search a GitHub checkout, clone it and run xerj autoindex. For selected public corpora, xerj ask answers from a signed pack without a clone. That path is limited to the Corpus Hub catalogue, and it is a different product surface than semantic search over an arbitrary repo. On a XERJ node the default embedding mode is lexical, not neural.

A local search engine for agents, not only for code, is What is a local AI search engine?.

Read next

Syntax-aware search, semantic search, hybrid search and grep and ripgrep alternatives.

FAQ

What is semantic code search?

It ranks source passages by meaning, not only by the exact words in the query. Use it when you can describe the behaviour but do not know the symbol name.

How is that different from syntax-aware search?

Syntax-aware search finds definitions and other syntactic forms, using a parser such as tree-sitter. It is the right tool when you already know the name. Semantic search is the right tool when you only have a description.

Does XERJ do semantic code search by default?

The default embedding mode is lexical, not neural. Semantic queries still run, but they use word and sub-word overlap plus BM25 unless you start the node with --embed-mode neural.

Can I search a GitHub repo this way?

Clone the repo, or index a local checkout, then run xerj autoindex. For selected public corpora, xerj ask answers from a signed pack without a clone. That is a different path, limited to the Corpus Hub catalogue.

How do I call this from an agent?

Use xerj mcp. On main it registers 24 tools, or 21 with no Corpus Hub key. The comparison of local code search MCP tools is on Best code search MCP tools, tested.

Evidence

Related