less delay on search; start on 2 chars instead of 3

This commit is contained in:
Ilyaaaaaaaaaaaaa Zhitomirskiy 2011-07-29 12:26:04 -07:00
parent f560321626
commit 16bd3e4c2f
3 changed files with 5 additions and 7 deletions

View file

@ -62,7 +62,7 @@ class Person < ActiveRecord::Base
end
def self.search(query, user)
return [] if query.to_s.blank? || query.to_s.length < 3
return [] if query.to_s.blank? || query.to_s.length < 2
sql, tokens = self.search_query_string(query)
@ -84,8 +84,6 @@ class Person < ActiveRecord::Base
}.call
end
def self.public_search(query, opts={})
return [] if query.to_s.blank? || query.to_s.length < 3
sql, tokens = self.search_query_string(query)

View file

@ -28,11 +28,11 @@ var Search = {
}
},
options : function(){return {
minChars : 3,
minChars : 2,
onSelect: Search.selectItemCallback,
max : 5,
scroll : false,
delay : 200,
delay : 100,
cacheLength : 15,
extraParams : {limit : 4},
formatItem : Search.formatItem,

View file

@ -226,8 +226,8 @@ describe Person do
people.empty?.should be true
end
it 'should return nothing on a two character query' do
people = Person.search("in", @user)
it 'should return nothing on a one character query' do
people = Person.search("i", @user)
people.empty?.should be true
end