Created
November 3, 2014 23:32
-
-
Save jasonaden/c4282eb2e2e4ad31b19e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| searchTimeout = $interval(-> | |
| # Build more explicit query string to return better lucene results | |
| # As of 2014-10-20 wildcard searches seem broken. i.e., `q=brendon+b*` | |
| # returns a result as if it was `q=b*`, skipping all characters before | |
| # the escaped space [ms] | |
| formattedQuery = "#{queryString}*" unless hasSpace = / /.test queryString | |
| if hasSpace | |
| if css.isPhone(origQueryString) | |
| formattedQuery = "phone:#{queryString}*" | |
| else | |
| formattedQuery = "name:#{queryString}*" | |
| search = Customer.search(q:"#{formattedQuery}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment