I have attached the code we use in an HTML widget in one of our spaces.
Our Use Case
We had a large FAQ document which covered many topics. Our users tended to comment on various topics at the bottom of the document which got confusing. We decided to split the FAQs into separate Questions and Answers and provide the Spotlight search on the space to surface this information to our users.