Giter VIP home page Giter VIP logo

Comments (5)

rusty1s avatar rusty1s commented on June 9, 2024

This module just replaces the values with i18n: true with an object that contains the values of all defined languages, so cross-language searches are not directly supported. You should check the mongoose api to find what you are looking for.

from mongoose-i18n-localize.

joshkopecek avatar joshkopecek commented on June 9, 2024

Yeah, already looked into this quite deeply. It seems when you have a dynamic key for an object there's no way to do a search across all keys (something like {'name.*': /searchstring/}), unless you declare them in advance and enumerate the individual keys. Then you end up with a million $ors and huge objects with redundant keys.

That also means for my app I would have to declare all potential languages.

This was also a problem when I was working with MySQL, where you could serialize a string, but then it removed the possibility of indexing it properly.

from mongoose-i18n-localize.

rusty1s avatar rusty1s commented on June 9, 2024

You need to declare all potentials languages anyway, so the best option would be to write a wrapper that does what you describe above.

from mongoose-i18n-localize.

joshkopecek avatar joshkopecek commented on June 9, 2024

Thanks. Still not finalised exactly how I'm going to do this with a search facility unless search on the client end is done using separate languages.

from mongoose-i18n-localize.

jfmmm avatar jfmmm commented on June 9, 2024

How did you made that work? Even if I specify each language in the index it won't work.

posts.index({
  'title.fr': 'text',
  'title.en': 'text'
});

edit: or you went with the manual regex way? That seem to work but it's not pretty and won't work well with french special character.

from mongoose-i18n-localize.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.