In my rails project I am using mongomapper gem and Here is the query for searching certain company. Currently, It taking almost half minutes to return results for a matching pattern and I would like to improve performance so the result can load fast. I heard the index will not work for regex queries, is this true? and what are other ways to improve performance
Company.where(name: /#{Regexp.escape(name)}/i)
Aucun commentaire:
Enregistrer un commentaire