Diacritic Case-Insensitive search Loopback

前提是你 提交于 2019-12-03 12:24:18

What you want ought to be possible with text indices as of version 3.1.7 of MongoDB. Please see SERVER-19557 for details. Earlier versions can not deal with diacritics.

Setting up a text index is rather easy: simply create an index on all fields you want to be searched – there can be only one text index per collection:

db.yourCollection.createIndex(
  {"name.text":"text","foo":"text"},
  {"default_language":"french"}
)

Now, to search your index, you simply do the following:

db.yourCollection.find(
  { $text: {$search:"Olimpic"} }
)

which should give you the expected results.

hth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!