content_type=codeCode
Source files, repository content and code-bearing pages: the implementation itself rather than an article describing an implementation.
Pages whose substance is code rather than prose about code. Useful when an agent needs an actual implementation rather than a description of one.
Pair it with `term` when the thing you are looking for is a literal: a function name, a flag, a panic string. Semantic retrieval has no useful neighbourhood for an identifier, so an exact requirement layered over the query is what makes code search behave.
What this covers
- source files
- gists
- example directories
Example
curl -H "x-api-key: $UNLOB_API_KEY" \
"https://api.unlob.com/search?q=your+query&content_type[]=code&limit=10"Common questions
What is the code content type?
Source files, repository content and code-bearing pages: the implementation itself rather than an article describing an implementation.
How do I search only code?
Set content_type[]=code on any search request. Content type is assigned at index time from page structure and markup rather than guessed from the URL, so the filter is reliable.
When is the code filter worth using?
Pair it with `term` when the thing you are looking for is a literal: a function name, a flag, a panic string. Semantic retrieval has no useful neighbourhood for an identifier, so an exact requirement layered over the query is what makes code search behave.
Filter by what a page is
Content type is assigned at index time from structure, not guessed from the URL — so the filter does what it says.