How company search matching works
How CNPJá company search finds results: words, accents and stems, free text search, relevance order and how long it takes for a new CNPJ to appear in results.
CNPJá company search finds establishments by name, address, contacts and filters such as activity, municipality and registration status, without you having to know the CNPJ. It compares words regardless of case and accents, sorts results by relevance and reads only the CNPJá database, where a CNPJ that just arrived can be found within a few minutes. The rules apply to the search in the app and in the API, except where this page points out a difference.
Each result is an establishment
Each result is a full CNPJ: the head office or a branch of a company. Company data, such as legal name, share capital, legal nature, size, tax regime and partners, is the same for all of its establishments, as explained in What belongs to the company and what to the establishment. For this reason, a filter on the company, such as size or share capital, returns every establishment of that company that matches the other filters. To get one result per company, also filter for head offices: in the app, Type > Head office.
Search reads only the CNPJá database, the cached data, and does not query the sources at that moment. A value in the results may be out of date: for the current registration of a CNPJ you found, open its record and update the sources, as explained in Data freshness.
Words, accents and punctuation
Free text search and the word filters on names compare words, not the exact text:
- they ignore case and accents:
São JosématchesSAO JOSE; - they remove punctuation without splitting words:
S/matchesA SA; - they compare words by their Portuguese stem, always as whole words:
mercadomatchesmercados, but notsupermercado.
The other filters compare exact values: codes, such as CNAE, municipality and CEP, phones, emails and email domains, each as a whole.
The street, number, address details and district filters compare the whole value, not separate words, in the app and in the API, with the same case, accent, punctuation and stem rules: Rua São José matches RUA SAO JOSE, but not RUA SAO JOSE DOS CAMPOS. In the app, they are the Street, Number, Address details and District filters, described in All filters; in the API, such as address., they accept only in and nin, not some or none.
Include and exclude words
In a word filter, each word counts on its own, even when you type several together: including pao de queijo returns any name with pao, with de or with queijo. Excluding words removes from the results every name that has any of them. Free text search works the other way around: it returns only results that have every word typed, in any order.
Use free text search to find a specific company, and the word filters to gather a segment by alternative words, such as padaria and confeitaria.
Filters combine like this:
- within a filter, a result needs to match only one of the included values, and a result with any excluded value is left out;
- different filters add up, and a result must match all of them at once;
- free text search adds to the filters.
How to include and exclude values in the app is in Include and exclude.
Free text search
Free text search, the search’s text box, looks for the words in all of these at once:
| Data | How it is matched |
|---|---|
| CNPJ | In full or by its beginning, from 3 characters, with or without punctuation. The root, such as 98., returns every establishment of the company |
| Legal name and trade name | By their words, with the rules in Words, accents and punctuation |
| Phones | By the full number, with or without the country code 55 and the area code, without spaces: 5511900000000, 11900000000 or 900000000 |
| Emails | By the full address, such as contato@empresa., or by the domain, such as empresa. |
| Address | Street, number, details, district, municipality name, state and CEP |
Result order
Unless another order is chosen, results come by relevance. In a free text search with more than one word, results that have the words as an exact phrase come first. Then relevance favors head offices, active establishments and larger companies. Tied results follow the CNPJ in ascending order, so the order is the same on every page.
The search in the app always uses relevance, and the table columns do not reorder the results. In the API, you can also sort by CNPJ, opening date, share capital or legal name, as shown in In the API.
Results are not fixed
Each page of results is read from the database when you open it. If the data changes while you go through the pages, an establishment can appear on two pages or on none, a page can come back short before the end, and the count can change from one read to the next.
To keep a fixed set of CNPJs, save the results to a list, which only changes when you add or remove CNPJs. A view keeps the search and the filters, and its results follow the database. See View or list?.
When a new CNPJ appears
Search uses an index updated periodically from the CNPJá database. A CNPJ that enters the database, such as one opened after the latest CNPJ open data release and queried live, can be found within a few minutes. Updates to a CNPJ already in the database reach the filters within a few hours.
- A CNPJ opened after the latest release and never queried live is not in the database, so it does not appear in search, as explained in What is in the cache.
- Each result shows the database values at the time of the search, which can be more recent than those the filters used. Right after an update, a result can show a value that no longer matches the applied filter.
- A list can hold CNPJs that are not in search yet. They only appear in results filtered by the list after they enter the database and the index.
What cannot be filtered
- State registration and SUFRAMA: search does not filter by state registration or SUFRAMA registration, and the results do not carry this data, which depends on live queries. Find the establishments by state or municipality and look up each CNPJ, as explained in State registration and CCC and SUFRAMA and Free Trade Zone incentives.
- Municipality by name: the municipality filters use the IBGE code. In the app, the City filter looks the name up in the list and applies the code. The municipality name is only compared as text in free text search.
- Partners: company search has no partner filter. To find a person’s companies, use the partner search.
Where it appears in the app
- Search CNPJ: the Search a CNPJ, name or address box is the free text search, and the filters sit on the bar above the table. See Search CNPJs and Search filters.
- Views and lists: the page of a view or of a list shows its results with the same rules. See Views and Create and manage lists.
- Global search: the global search (
Ctrl+K, or⌘Kon a Mac) looks for companies with the free text search rules. See Global search and keyboard shortcuts.
In the API
Search is the Search CNPJ operation. Free text search goes in search, and filters take the form field., such as names. to include words in the names and names. to exclude them. The order can be chosen with sort and order, and the following pages are read with a cursor. The parameters, the fields and the list operations are in CNPJ search and lists in the API.