UNPKG

atriusmaps-node-sdk

Version:

This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information

26 lines (22 loc) 586 B
'use strict'; var FlexSearch = require('flexsearch'); var simple = require('./flexsearchExports/simple.js'); const NON_ASCII_LANGUAGES = ["ko", "ja", "zh-Hans", "zh-Hant"]; const getFlexSearchInstance = ({ lang }) => { const options = { tokenize: "reverse", rtl: lang === "ar", // only for arabic stemmer: { s: "", es: "", ies: "y" }, encode: simple.encode }; if (NON_ASCII_LANGUAGES.includes(lang)) { options.tokenize = "full"; } return new FlexSearch.Index(options); }; exports.getFlexSearchInstance = getFlexSearchInstance;