Skip to content

Instantly share code, notes, and snippets.

@actuosus
Created September 4, 2015 19:01
Show Gist options
  • Save actuosus/e537ce4ad67a1e1965f0 to your computer and use it in GitHub Desktop.
Save actuosus/e537ce4ad67a1e1965f0 to your computer and use it in GitHub Desktop.
Index: public/js/views/search_input.js
===================================================================
--- public/js/views/search_input.js (revision )
+++ public/lib/js/views/search_input.js (revision )
@@ -101,7 +101,7 @@
// `facetMatches` callback to skip any further ordering done client-side.
autocompleteValues : function(req, resp) {
var searchTerm = req.term;
- var lastWord = searchTerm.match(/\w+\*?$/); // Autocomplete only last word.
+ var lastWord = searchTerm.match(/[a-zA-Zа-яА-ЯёЁ]+\*?$/); // Autocomplete only last word.
var re = VS.utils.inflector.escapeRegExp(lastWord && lastWord[0] || '');
this.app.options.callbacks.facetMatches(function(prefixes, options) {
options = options || {};
@@ -178,7 +178,7 @@
var matcher = new RegExp(lastWord[0], "i");
if (facetValue.search(matcher) == 0) {
- boxValue = boxValue.replace(/\b(\w+)$/, '');
+ boxValue = boxValue.replace(/\b([a-zA-Zа-яА-ЯёЁ]+)$/, '');
}
boxValue = boxValue.replace('^\s+|\s+$', '');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment