FlexSearch

Search your Doks site with FlexSearch. Easily customize index settings and search options to your liking.

FlexSearch Doks

Language settings

Insert after line 82 in ./assets/js/index.js the language specific settings, like so:

..

var index = new FlexSearch({
  preset: 'score',
  cache: true,
  doc: {
      id: 'id',
      field: [
        'title',
        'description',
        'content',
      ],
      store: [
        'href',
        'title',
        'description',
      ],
  },
  // Insert language specific settings below — e.g. Latin
  encode: "simple",
  tokenize: "forward"
});

..

Latin

..
  encode: "simple",
  tokenize: "forward"
..

Arabic

..
  encode: false,
  rtl: true,
  split: /\s+/,
  tokenize: "forward"
..

Cyrilic, Indian

Any word separated by space language:

..
  encode: false,
  split: /\s+/,
  tokenize: "forward"
..

Chinese, Japanese or Korean

With dedicated chars w/o spaces:

..
  encode: false,
  tokenize: function(str){
      return str.replace(/[\x00-\x7F]/g, "").split("");
  }
..

Source

Edit this page on GitHub