The solution mentioned at https://v2.docusaurus.io/docs/search/ by using Algolia DocSearch. But problem is "Note that your website needs to be publicly available for this to work (i.e., not behind a firewall). The service is free".
Has anyone tried: Flexsearch https://github.com/nextapps-de/flexsearch
I am aware that discussion is going at https://github.com/facebook/docusaurus/issues/776
You can look for some offline search plugins under our community plugins section. They are not officially endorsed but some of them work pretty well.