Server-side selectize with custom similarity metric



Goal: When the user types a query in selectize input, I'd like to filter the drop-down based on the usual string matching but also based on a custom similarity metric. For instance, if the user types 'Obama', I'd like the suggestions to contain 'Barack Obama', 'Obamacare', etc. (string matching) but also 'president' or 'politician' (synonyms).

Problem: the list of synonyms is returned in real-time by some function in server.R that takes what the user has typed as input. I think I need to use the 'Server-side selectize' approach described in this tutorial: But:

  • how can I access the character string in the text box to feed my function?
  • how can I get the updateSelectizeInput function to take the list of synonyms into account?