ICU chains configuration

From Koha Wiki
Jump to navigation Jump to search

Overview

To get searching with non-latin languages (such as Russian, Chinese and Arabic) working correctly in Koha you need to setup and configure ICU (International Components for Unicode) chains.

Install and configure ICU chains

To enable and configure ICU:

1. Install the yaz-icu package:

 sudo apt-get install yaz-icu

2. In the staff interface go to More > Administration > Global system preferences > Searching.

3. Change the UseICUStyleQuotes system preference to Using.

4. Change the QueryFuzzy system preference to Don't try.

5. Change the QueryStemming system preference to Don't try.

6. Edit /etc/koha/zebradb/etc/default.idx

 Change or add the bolded lines:
 
 # Traditional word index
 # Used if completenss is 'incomplete field' (@attr 6=1) and
 # structure is word/phrase/word-list/free-form-text/document-text
 index w
 completeness 0
 position 1
 alwaysmatches 1
 firstinfield 1
 icuchain words-icu.xml
 
 # Phrase index
 # Used if completeness is 'complete {sub}field' (@attr 6=2, @attr 6=1)
 # and structure is word/phrase/word-list/free-form-text/document-text
 index p
 completeness 1
 firstinfield 1
 icuchain phrases-icu.xml 

If the Koha instance is on a shared server and you only want to use ICU for this particular instance, this functionality was added in Bug 12216

7. Depending on the language you are searching, you may need to modify words-icu.xml or phrases-icu.xml - these are in the same directory as /etc/koha/zebradb/etc/default.idx. The ICU Chains Library covers the modifications required for several languages - you are encouraged to add more.

8. Restart Zebra and rebuild the search index.

 If you are using packages (the recommended way to install Koha), run:
 
  sudo koha-zebra --restart {yourinstancename}
  sudo koha-rebuild-zebra -f {yourinstancename}
 If you are using a git or tarball installation (not recommended for normal use) run these two commands (you will need to change the file paths to where they are on your system):
 
  /etc/init.d/koha-zebra-daemon restart
  /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -b -r -v -w 
 
 You may have to run these commands first: 
  
  sudo bash
  export PERL5LIB=/usr/share/koha/lib
  export KOHA_CONF=/etc/koha/sites/iesh/koha-conf.xml