Language and Locale
Every page and document in your Opensolr Index gets its language, as a two-letter code (en, de, ro). When a real country is known, it also gets its locale, the language plus the country (en_gb, de_at).
That is what lets a visitor keep only the pages in their language, and lets a site with one section per country show each country its own pages.
Your page says it, Opensolr believes it
A crawled page that declares its language gets exactly that. Opensolr takes the first of these it finds on the page:
og:localeinLanguagein the page's JSON-LD- the
Content-Languageyour server sends <meta http-equiv="content-language"><meta name="language">- an
hreflanglink that points to the page itself <html lang>
Only a page that declares nothing is detected from its words: the description, or the title when the description is too short, and the first words of the page only as a last resort. Menus and footers are often in another language, so the description and the title give the safer answer.
A PDF or another document has no tags, so it takes the Content-Language your server sends with the file, or is detected from its own text.
Locale only with a real country
The locale comes from a tag that carries a country (en-GB), or from the address of the page when it has one, like /en-gb/ or /sv-se/. When no country is known, the page has no locale. Opensolr never makes one up from the language.
When the detection is not sure, the page has no language either. No language is better than a wrong one.
Pushed documents
Send the language and the locale with each document and Opensolr checks them and keeps them. Leave them out and the language is detected from the title and the description, and the locale is taken from the address of the document. The field names are in Document fields.
What visitors get
- On the hosted search page, the All Languages list shows the languages found in your index, each with its number of documents.
- When the index has more than one locale, the All Locales button opens a panel grouped by language, then by country.
- The chat bot command
/languagetells the language and the tone of any text: Chat bot commands.
More on the filters: Date, language, locale and price filters.
What every page gets
- What every page gets
- Language and locale
- Sentiment
- Content quality score
- Prices and categories
- Video details