Search Synonyms for Zendesk Guide
Has anyone come up with a search synonym scheme to help with search results in Zendesk Guide? For us, we have some products that are frequently misspelled but no way (unless we tag all of them) to have them return in the search results or direct the user to the correct spelling. Has anyone attempted to do this?
Thanks!
Andrew
-
Interested in this as well. It would be incredibly helpful to have a way to designate specific misspellings to the correct spelling so we don't have to label multiple help articles with the correct and common incorrect spellings.
-
Hey Andrew!
There isn't anything built into the product that would do this for you, but I'm kind of wondering whether there's some kind of JavaScript hack that might allow it...I'm going to check with some of the coding gurus amongst our Moderators to see if there's anything there.
-
Hi Jessie,
Based on your suggestion, I've developed a code snippet that can do this. Add this to the js for the help center
$(document).ready(function() {
InitializeSynonyms()
});var synonymsets = new Array();
function NewSynonymSet(key, synonyms) {
var synonym = new Object();
synonym.primary = key;
synonym.keywords = synonyms;
synonymsets.push(synonym);
}function ChangeSearch(val)
{
var q = $(val).val();
var query = q.toLowerCase().split(' ');
for (var i = 0; i < query.length; i++) {
for (var x = 0; x < synonymsets.length; x++) {
var primary = synonymsets[x].primary;
var keywords = synonymsets[x].keywords;
if ($.inArray(query[i], keywords) > -1) {
query[i] = primary;
}
}
}
var newQuery = '';
for (var i = 0; i < query.length; i++) {
newQuery += ' ' + query[i];
}
$('#query').val(newQuery.substring(1));
}function InitializeSynonyms() {
//always lowercase and can handle misspellings too.
//Enter as many of these lines below as needed with different synonym sets
NewSynonymSet('sleep', ['dream', 'hybernate', 'nap', 'sleeep']);
$('#query').on('keyup', function () {
ChangeSearch(this);
});
$('#query').on('paste', function () {
ChangeSearch(this);
});
} -
@Andrew - Thanks! I have a couple questions for you on this. Does the above "activate" some sort of automatic translation of misspellings from a given database or source? Or is this line meant to be where we add all the possible synonyms/misspellings: NewSynonymSet('sleep', ['dream', 'hybernate', 'nap', 'sleeep']);
And again, thank you!!!
-
Hi Heather,
You would want to put multiple sets in there underneath the first for each one you would like to handle. I'll add a comment in the snippet above. There is no lookup to an outside source for synonyms so everything it looks at is entered manually.
NewSynonymSet('sleep', ['dream', 'hybernate', 'nap', 'sleeep']);
NewSynonymSet('sleep', ['dream', 'hybernate', 'nap', 'sleeep']);
NewSynonymSet('sleep', ['dream', 'hybernate', 'nap', 'sleeep']); -
Andrew! I love this. What a cool idea!
Can you pretty please share this as a tip!?
It'd be nice to show a picture, but not sure what you'd show it...unless it's a mispelled word, then the resulting correct search results. Whatever you can do. But at least the description and code and users will love it!!!
Thanks!
-
You are awesome, Andrew. Thanks so much for sharing your tip!
-
Hooray! I love it when a plan comes together. :D
댓글을 남기려면 로그인하세요.
9 댓글