|
|
Chapter 7. Languages support
7.1. Character sets7.1.1. Supported character setsDataparkSearch supports almost all known 8 bit character sets as well as some multi-byte charsets including Korean euc-kr, Chinese big5 and gb2312, Japanese shift-jis, euc-jp and iso-2022-jp, as well as UTF-8. Some multi-byte character sets are not supported by default, because the conversion tables for them are rather large that leads to increase of the executable files size. See configure parameters to enable support for these charsets. DataparkSearch also supports the following Macintosh character sets: MacCE, MacCroatian, MacGreek, MacRoman, MacTurkish, MacIceland, MacRomania, MacThai, MacArabic, MacHebrew, MacCyrillic, MacGujarati. Table 7-1. Language groups
7.1.2. Character sets aliasesEach charset is recognized by a number of its aliases. Web servers can return the same charset in different notation. For example, iso-8859-2, iso8859-2, latin2 are the same charsets. There is support for charsets names aliases which search engine can understand: Table 7-2. Charsets aliases
7.1.3. Recodingindexer recodes all documents to the character set specified in the LocalCharset command in your indexer.conf file. Internally recoding is implemented using Unicode. Please note that if some recoding can't convert a character directly from one charset to another, DataparkSearch will use HTML numeric character references to escape this character (i.e. in form &#NNN; where NNN - a character code in Unicode). Thus, for any LocalCharset you do not lost any information about indexed documents, but on LocalCharset selection depend the database volume you will get after indexing. 7.1.4. Recoding at search timeYou may display search results in any charset supported by DataparkSearch. Use BrowserCharset command in search.htm to select charset for search results. This charset may be different from LocalCharset specified. All recodings will done automatically. 7.1.5. Document charset detectionindexer detects document character set in this order: 7.1.6. Automatic charset guesserDataparkSearch has an automatic charset and language guesser. It currently recognizes more than 100 various charsets and languages. Charset and language detection is implemented using "N-Gram-Based Text Categorization" technique. There is a number of so called "language map" files, one for each language-charset pair. They are installed under /usr/local/dpsearch/etc/langmap/ directory by default. Take a look there to check the list of currently provided charset-language pairs. Guesser works fine for texts bigger than 500 characters. Shorter texts may not be guessed well. 7.1.6.1. LangMapFile commandLoad language map for charset and language guesser from the given file. You may specify either absolute file name or a name relative to DataparkSearch /etc directory. You may use several LangMapFile commands. LangMapFile langmap/en.ascii.lm 7.1.6.2. Build your own language mapsTo build your own language map use dpguesser utility. In addition, your need to collect file with language samples in charset desired. For new language map creation, use the following command: dpguesser -p -c charset -l language < FILENAME > language.charset.lm You can also use dpguesser utility for guessing document's language and charset by existing language maps. To do this, use following command: dpguesser [-n maxhits] < FILENAME For some languages, it may be used few different charset. To convert from one charset supported by DataparkSearch to another, use dpconv utility. dpconv [OPTIONS] -f charset_from -t charset_to [configfile] < infile > outfileYou may also specyfy -e switch for dpconv to use HTML escape entities for input, and -E switch - for output. By default, both dpguesser and dpconv utilities is installed into /usr/local/dpsearch/sbin/ directory. DataparkSearch can update language and charset maps automatically while indexing, if remote server is supply exactly specified language and charset with pages. To enable this function, specify the following command in your indexer.conf file: LangMapUpdate yes By default, DataparkSearch uses only first 8192 bytes of each file indexed to detect language and charset. You may change this value using GuesserBytes command. Use value of 0 to use all text from document indexed. GuesserBytes 16384 7.1.7. Default charsetUse RemoteCharset command in indexer.conf to choose the default charset of indexed servers. 7.1.8. Default LanguageYou can set default language for Servers by using DefaultLang <string> Default language for server. Can be used if you need language restriction while doing search. DefaultLang en 7.1.9. LocalCharset commandDefines the charset which will be used to store data in database. All other character sets will be recoded into given charset. Take a look into Section 7.1> for detailed explanation how to choose a LocalCharset depending on languages used on your site(s). This command should be used once and takes global effect for the config file. Take a look into documentation to check whole list of supported charsets. Default LocalCharset is iso-8859-1 (latin1). LocalCharset koi8-r 7.1.10. ForceIISCharset1251 commandThis option is useful for users which deals with Cyrillic content and broken (or misconfigured ?) Microsoft IIS web servers, which tends to not report charset correctly. This is really dirty hack, but if this option is turned on it is assumed that all servers which reports as 'Microsoft' or 'IIS' have content in Windows-1251 charset. This command should be used only once in configuration file and takes global effect. Default: no ForceIISCharset1251 yes 7.1.11. RemoteCharset commandRemoteCharset <charset>
RemoteCharset iso-8859-5 7.1.12. URLCharset commandURLCharset <charset>
URLCharset KOI8-R 7.1.13. CharsToEscape commandCharsToEscape "\"&<>![]" Use this command in your search template to specify the list of characters to escape for $&(x) search template meta-variables. |