About Me

My photo
Muthupet, TamilNadu, India
SharePoint 2010

Wednesday, May 15, 2019

Sharepoint Voice Search


Ever thought of implementing an shopping app like voice search in your Sharepoint site as a part of search? This neat little trick can help you achieve just that.

In the not so recent past, I was asked to improve a Sharepoint site by adding functionalities to it and keeping it up to date with the most recent trends. Voice search was one functionality that immediately came to my mind. When I found out that Microsoft did not offer it out of box, I jumped on the opportunity.

What I did here was convert the functionality into two parts. i.e. a) Voice to text conversion and b) Redirection after voice search.
Both of which were simple to achieve. For part a) , I implemented the voice to text webkit which is readily available in this link: https://tutorialzine.com/2017/08/converting-from-speech-to-text-with-javascript

The webkit allows you to start and stop recording and also auto stop if you want to specify a time period. I went ahead with auto stop and hooked the text thus converted with a redirect to the Sharepoint search page with the text as q query in the query string. i.e.https://xyz.sharepoint.com/sites/sp2013/search/pages/results.aspx?k=(Voice to text converted text)
Then its just a matter of hooking up the search functionality to the Sharepoint search box via the javascript that contains your webkit functionality. You can add a fancy mic like logo as a button for your voice search and add it inside the search box or outside.

For modern sites in Sharepoint Online we could go with creating an spfx webpart and implementing the same or creating a script editor webpart in spfx, adding it to the site and then pasting the script in the script editor (considering the site is not in "no script" enviroment).

Cheers!