Proposal for a new personalized experience in the Open Food Facts app and website

I don’t know. There are some ways to have a custom sort order in mongodb by adding extra aggregations steps (e.g. MongoDB sort with a custom expression or function - Stack Overflow ), but then that means we can’t use indexes and we have to score and rank all possibly matching products.

But we could do things a bit differently. e.g. do what we currently do client side (get a big number of results (between 100 and 1000), and then re-rank them), and possibly cache it server side.

Or we could have a separate database (e.g. in postgresql) that would be specifically tailored for searching.