我在我的应用程序中添加了即时搜索功能。
它完全按照我在本地服务器上的要求工作:
- 缩小按键列表
- 不分大小写
- 允许重置(因此,如果我键入内容然后将其删除,则搜索会重置,并且不会变窄)。它也允许回溯,所以如果我输入错误并删除了错误输入的字母,搜索会相应地修复。
在生产中,这种行为是完全奇怪的。虽然它也进行按键搜索,但它有许多奇怪的问题。
- 它区分大小写(与开发不同)——这不是我想要的。
- 关于重置,它的行为很奇怪。如果我输入“instatn”之类的内容然后更正错误,它不会重做搜索。如果我删除整个条目,它也不会重做搜索。然而,奇怪的是,
- 如果我删除搜索词然后键入一个字母,它会重置搜索。
- 它似乎没有正确搜索,期间。如果我输入“z”,尽管我正在搜索的所有项目都不包含“z”,但它们都不会消失。另一方面,如果我输入“Blogging”,列表实际上会缩小到名称中包含该词的两个项目。
知道这里发生了什么吗?为什么两者不同?我该如何解决?让我知道什么样的代码可能有助于解释。
我的代码:
存档.html.erb
<%= form_tag @post, :method => 'get', :id => "posts_search", class: "search_form squeeze form-inline" do %>
<p>
<%= text_field_tag :search, params[:search],
placeholder: "Search titles:", id: "search_field" %>
<%= submit_tag "Search", name: nil, class: "btn squeeze search" %>
</p>
<div id="list"><%= render 'search' %></div>
<% end %>
_search.html.erb
<ul class="blog_links">
<% @posts.first(@link_num).each do |p| %>
<li class="total_hover">
<%= p.name %>
</li>
<% end %>
</ul>
归档.js.erb
$("#list").html("<%= escape_javascript(render("search")) %>");
post_controller.rb
def archive
@posts = Post.search(params[:search]).reverse
respond_to do |format|
format.html # index.html.erb
format.json { render json: @posts }
format.js
end
end
def search
@posts = Post.search(params[:search]).reverse
render json: { results: @posts }
end
post.rb
def self.search(search)
if search
where('name LIKE ?', "%#{search}%")
else
scoped
end
end
javascripts/posts.js.coffee
@search = ->
$.get $('#posts_search').attr("action"), $("#posts_search").serialize(), null, "script"
$ ->
$('#posts_search input').keypress -> search()
$('#posts_search').submit (e) ->
e.preventDefault()
search()
路线.rb
match '/search', to: 'posts#search'
match '/archive', to: 'posts#archive'
编辑为了提供一些线索,我在两种环境中执行相同的用户行为并发布博客。我要做的是:
- 加载包含搜索的页面。
- 输入“Blgo”
- 删除“go”并将其替换为“og”
- 删除所有内容并搜索“Insta”
开发日志
Started GET "/archive" for 127.0.0.1 at 2013-02-28 23:20:52 -0800
Processing by PostsController#archive as HTML
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts"
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (55.7ms)
Rendered posts/archive.html.erb within layouts/application (57.0ms)
Rendered layouts/_shim.html.erb (0.0ms)
Rendered layouts/_header.html.erb (0.7ms)
Completed 200 OK in 74ms (Views: 72.2ms | ActiveRecord: 0.3ms)
# Cut out bootstrap loading etc for brevity
Started GET "/archive?utf8=%E2%9C%93&search=&_=1362122453454" for 127.0.0.1 at 2013-02-28 23:20:54 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"", "_"=>"1362122453454"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (13.2ms)
Rendered posts/archive.js.erb (14.7ms)
Completed 200 OK in 18ms (Views: 16.6ms | ActiveRecord: 0.3ms)
Started GET "/archive?utf8=%E2%9C%93&search=b&_=1362122453455" for 127.0.0.1 at 2013-02-28 23:20:54 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"b", "_"=>"1362122453455"}
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%b%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.4ms)
Rendered posts/archive.js.erb (3.7ms)
Completed 200 OK in 7ms (Views: 5.6ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=b&_=1362122453456" for 127.0.0.1 at 2013-02-28 23:20:54 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"b", "_"=>"1362122453456"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%b%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.2ms)
Rendered posts/archive.js.erb (3.4ms)
Completed 200 OK in 7ms (Views: 5.7ms | ActiveRecord: 0.3ms)
Started GET "/archive?utf8=%E2%9C%93&search=bl&_=1362122453457" for 127.0.0.1 at 2013-02-28 23:20:54 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"bl", "_"=>"1362122453457"}
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%bl%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.0ms)
Rendered posts/archive.js.erb (3.2ms)
Completed 200 OK in 6ms (Views: 5.1ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=bl&_=1362122453458" for 127.0.0.1 at 2013-02-28 23:20:55 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"bl", "_"=>"1362122453458"}
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%bl%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (1.9ms)
Rendered posts/archive.js.erb (3.1ms)
Completed 200 OK in 6ms (Views: 4.9ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=blg&_=1362122453459" for 127.0.0.1 at 2013-02-28 23:20:55 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"blg", "_"=>"1362122453459"}
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%blg%')
Rendered posts/_search.html.erb (0.0ms)
Rendered posts/archive.js.erb (1.3ms)
Completed 200 OK in 5ms (Views: 3.8ms | ActiveRecord: 0.1ms)
Started GET "/archive?utf8=%E2%9C%93&search=blg&_=1362122453460" for 127.0.0.1 at 2013-02-28 23:20:55 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"blg", "_"=>"1362122453460"}
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE (name LIKE '%blg%')[0m
Rendered posts/_search.html.erb (0.0ms)
Rendered posts/archive.js.erb (1.2ms)
Completed 200 OK in 4ms (Views: 3.3ms | ActiveRecord: 0.1ms)
Started GET "/archive?utf8=%E2%9C%93&search=blgo&_=1362122453461" for 127.0.0.1 at 2013-02-28 23:20:55 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"blgo", "_"=>"1362122453461"}
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%blgo%')
Rendered posts/_search.html.erb (0.0ms)
Rendered posts/archive.js.erb (1.3ms)
Completed 200 OK in 5ms (Views: 3.9ms | ActiveRecord: 0.1ms)
Started GET "/archive?utf8=%E2%9C%93&search=blg&_=1362122453462" for 127.0.0.1 at 2013-02-28 23:20:55 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"blg", "_"=>"1362122453462"}
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE (name LIKE '%blg%')[0m
Rendered posts/_search.html.erb (0.0ms)
Rendered posts/archive.js.erb (1.2ms)
Completed 200 OK in 4ms (Views: 3.2ms | ActiveRecord: 0.1ms)
Started GET "/archive?utf8=%E2%9C%93&search=bl&_=1362122453463" for 127.0.0.1 at 2013-02-28 23:20:55 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"bl", "_"=>"1362122453463"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%bl%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.0ms)
Rendered posts/archive.js.erb (3.2ms)
Completed 200 OK in 6ms (Views: 5.1ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=bl&_=1362122453464" for 127.0.0.1 at 2013-02-28 23:20:56 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"bl", "_"=>"1362122453464"}
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%bl%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.1ms)
Rendered posts/archive.js.erb (3.4ms)
Completed 200 OK in 7ms (Views: 5.3ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=blo&_=1362122453465" for 127.0.0.1 at 2013-02-28 23:20:56 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"blo", "_"=>"1362122453465"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%blo%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.8ms)
Rendered posts/archive.js.erb (5.0ms)
Completed 200 OK in 9ms (Views: 7.9ms | ActiveRecord: 0.3ms)
Started GET "/archive?utf8=%E2%9C%93&search=blog&_=1362122453466" for 127.0.0.1 at 2013-02-28 23:20:56 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"blog", "_"=>"1362122453466"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%blog%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.8ms)
Rendered posts/archive.js.erb (4.1ms)
Completed 200 OK in 7ms (Views: 6.0ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=blog&_=1362122453467" for 127.0.0.1 at 2013-02-28 23:20:56 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"blog", "_"=>"1362122453467"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%blog%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.0ms)
Rendered posts/archive.js.erb (3.2ms)
Completed 200 OK in 7ms (Views: 5.3ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=blo&_=1362122453468" for 127.0.0.1 at 2013-02-28 23:20:57 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"blo", "_"=>"1362122453468"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%blo%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.1ms)
Rendered posts/archive.js.erb (3.3ms)
Completed 200 OK in 6ms (Views: 5.2ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=bl&_=1362122453469" for 127.0.0.1 at 2013-02-28 23:20:57 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"bl", "_"=>"1362122453469"}
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%bl%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (1.9ms)
Rendered posts/archive.js.erb (3.1ms)
Completed 200 OK in 6ms (Views: 5.0ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=b&_=1362122453470" for 127.0.0.1 at 2013-02-28 23:20:57 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"b", "_"=>"1362122453470"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%b%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.0ms)
Rendered posts/archive.js.erb (3.2ms)
Completed 200 OK in 6ms (Views: 5.0ms | ActiveRecord: 0.2ms)
Started GET "/archive?utf8=%E2%9C%93&search=&_=1362122453471" for 127.0.0.1 at 2013-02-28 23:20:58 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"", "_"=>"1362122453471"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%%')
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (17.9ms)
Rendered posts/archive.js.erb (19.4ms)
Completed 200 OK in 23ms (Views: 21.2ms | ActiveRecord: 0.4ms)
Started GET "/archive?utf8=%E2%9C%93&search=&_=1362122453472" for 127.0.0.1 at 2013-02-28 23:20:58 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"", "_"=>"1362122453472"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (12.2ms)
Rendered posts/archive.js.erb (13.7ms)
Completed 200 OK in 17ms (Views: 15.6ms | ActiveRecord: 0.3ms)
Started GET "/archive?utf8=%E2%9C%93&search=I&_=1362122453473" for 127.0.0.1 at 2013-02-28 23:20:58 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"I", "_"=>"1362122453473"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%I%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (4.6ms)
Rendered posts/archive.js.erb (5.8ms)
Completed 200 OK in 9ms (Views: 7.7ms | ActiveRecord: 0.2ms)
#... You get the picture. I went over character count. (!)
Started GET "/archive?utf8=%E2%9C%93&search=Insta&_=1362122453481" for 127.0.0.1 at 2013-02-28 23:20:59 -0800
Processing by PostsController#archive as JS
Parameters: {"utf8"=>"✓", "search"=>"Insta", "_"=>"1362122453481"}
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE (name LIKE '%Insta%')
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 1]]
Rendered posts/_search.html.erb (2.2ms)
Rendered posts/archive.js.erb (3.5ms)
Completed 200 OK in 7ms (Views: 5.5ms | ActiveRecord: 0.3ms)
heroku 日志
013-03-01T07:23:21+00:00 app[web.1]: Started GET "/archive" for 69.181.104.85 at 2013-03-01 07:23:21 +0000
2013-03-01T07:23:21+00:00 heroku[router]: at=info method=GET path=/archive host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=1ms service=43ms status=200 bytes=3343
2013-03-01T07:23:21+00:00 app[web.1]: Processing by PostsController#archive as HTML
2013-03-01T07:23:21+00:00 app[web.1]: Completed 200 OK in 20ms (Views: 5.2ms | ActiveRecord: 13.2ms)
2013-03-01T07:23:21+00:00 app[web.1]: Rendered posts/_search.html.erb (2.2ms)
2013-03-01T07:23:21+00:00 app[web.1]: Rendered layouts/_header.html.erb (0.5ms)
2013-03-01T07:23:21+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.0ms)
2013-03-01T07:23:21+00:00 app[web.1]: Rendered posts/archive.html.erb within layouts/application (2.8ms)
2013-03-01T07:23:24+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=&_=1362122601827" for 69.181.104.85 at 2013-03-01 07:23:24 +0000
2013-03-01T07:23:24+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:24+00:00 app[web.1]: Rendered posts/_search.html.erb (2.5ms)
2013-03-01T07:23:24+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"", "_"=>"1362122601827"}
2013-03-01T07:23:24+00:00 app[web.1]: Rendered posts/archive.js.erb (3.0ms)
2013-03-01T07:23:24+00:00 app[web.1]: Completed 200 OK in 12ms (Views: 3.6ms | ActiveRecord: 7.1ms)
2013-03-01T07:23:24+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=b&_=1362122601828" for 69.181.104.85 at 2013-03-01 07:23:24 +0000
2013-03-01T07:23:24+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:24+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"b", "_"=>"1362122601828"}
2013-03-01T07:23:24+00:00 app[web.1]: Rendered posts/archive.js.erb (0.4ms)
2013-03-01T07:23:24+00:00 app[web.1]: Rendered posts/_search.html.erb (0.0ms)
2013-03-01T07:23:24+00:00 app[web.1]: Completed 200 OK in 6ms (Views: 0.9ms | ActiveRecord: 3.7ms)
2013-03-01T07:23:24+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=b&_=1362122601828 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=2ms service=53ms status=200 bytes=53
2013-03-01T07:23:24+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=&_=1362122601827 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=2ms service=198ms status=200 bytes=703
2013-03-01T07:23:24+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=bl&_=1362122601829" for 69.181.104.85 at 2013-03-01 07:23:24 +0000
2013-03-01T07:23:24+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:24+00:00 app[web.1]: Rendered posts/_search.html.erb (0.0ms)
2013-03-01T07:23:24+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"bl", "_"=>"1362122601829"}
2013-03-01T07:23:24+00:00 app[web.1]: Completed 200 OK in 5ms (Views: 0.9ms | ActiveRecord: 2.9ms)
2013-03-01T07:23:24+00:00 app[web.1]: Rendered posts/archive.js.erb (0.4ms)
2013-03-01T07:23:24+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=bl&_=1362122601829 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=1ms service=89ms status=200 bytes=53
2013-03-01T07:23:24+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=blg&_=1362122601830 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=2ms service=20ms status=200 bytes=53
2013-03-01T07:23:24+00:00 app[web.1]: Completed 200 OK in 4ms (Views: 0.8ms | ActiveRecord: 2.6ms)
2013-03-01T07:23:24+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"blg", "_"=>"1362122601830"}
2013-03-01T07:23:24+00:00 app[web.1]: Rendered posts/archive.js.erb (0.4ms)
2013-03-01T07:23:24+00:00 app[web.1]: Rendered posts/_search.html.erb (0.0ms)
2013-03-01T07:23:24+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:24+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=blg&_=1362122601830" for 69.181.104.85 at 2013-03-01 07:23:24 +0000
2013-03-01T07:23:27+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=bl&_=1362122601831" for 69.181.104.85 at 2013-03-01 07:23:27 +0000
2013-03-01T07:23:28+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=bl&_=1362122601831 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=2ms service=26ms status=200 bytes=53
2013-03-01T07:23:28+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"bl", "_"=>"1362122601831"}
2013-03-01T07:23:28+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:28+00:00 app[web.1]: Rendered posts/_search.html.erb (0.0ms)
2013-03-01T07:23:28+00:00 app[web.1]: Rendered posts/archive.js.erb (0.3ms)
2013-03-01T07:23:28+00:00 app[web.1]: Completed 200 OK in 5ms (Views: 0.9ms | ActiveRecord: 2.6ms)
2013-03-01T07:23:28+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=blo&_=1362122601832" for 69.181.104.85 at 2013-03-01 07:23:28 +0000
2013-03-01T07:23:28+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:28+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"blo", "_"=>"1362122601832"}
2013-03-01T07:23:28+00:00 app[web.1]: Completed 200 OK in 4ms (Views: 0.8ms | ActiveRecord: 2.6ms)
2013-03-01T07:23:28+00:00 app[web.1]: Rendered posts/_search.html.erb (0.0ms)
2013-03-01T07:23:28+00:00 app[web.1]: Rendered posts/archive.js.erb (0.3ms)
2013-03-01T07:23:28+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=blo&_=1362122601832 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=2ms service=61ms status=200 bytes=53
2013-03-01T07:23:30+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=&_=1362122601833" for 69.181.104.85 at 2013-03-01 07:23:30 +0000
2013-03-01T07:23:30+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:30+00:00 app[web.1]: Rendered posts/archive.js.erb (2.5ms)
2013-03-01T07:23:30+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"", "_"=>"1362122601833"}
2013-03-01T07:23:30+00:00 app[web.1]: Completed 200 OK in 7ms (Views: 3.0ms | ActiveRecord: 3.3ms)
2013-03-01T07:23:30+00:00 app[web.1]: Rendered posts/_search.html.erb (2.1ms)
2013-03-01T07:23:30+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=&_=1362122601833 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=1ms service=19ms status=200 bytes=703
2013-03-01T07:23:32+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=I&_=1362122601834" for 69.181.104.85 at 2013-03-01 07:23:32 +0000
2013-03-01T07:23:32+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=I&_=1362122601834 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=2ms service=20ms status=200 bytes=218
2013-03-01T07:23:32+00:00 app[web.1]: Rendered posts/archive.js.erb (1.0ms)
2013-03-01T07:23:32+00:00 app[web.1]: Completed 200 OK in 6ms (Views: 2.2ms | ActiveRecord: 2.6ms)
2013-03-01T07:23:32+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"I", "_"=>"1362122601834"}
2013-03-01T07:23:32+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:32+00:00 app[web.1]: Rendered posts/_search.html.erb (0.7ms)
2013-03-01T07:23:32+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=In&_=1362122601835" for 69.181.104.85 at 2013-03-01 07:23:32 +0000
2013-03-01T07:23:32+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"In", "_"=>"1362122601835"}
2013-03-01T07:23:32+00:00 app[web.1]: Rendered posts/_search.html.erb (0.7ms)
2013-03-01T07:23:32+00:00 app[web.1]: Rendered posts/archive.js.erb (1.1ms)
2013-03-01T07:23:32+00:00 app[web.1]: Completed 200 OK in 5ms (Views: 1.5ms | ActiveRecord: 2.8ms)
2013-03-01T07:23:32+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:32+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=In&_=1362122601835 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=2ms service=27ms status=200 bytes=218
2013-03-01T07:23:32+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=Ins&_=1362122601836" for 69.181.104.85 at 2013-03-01 07:23:32 +0000
2013-03-01T07:23:32+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:32+00:00 app[web.1]: Completed 200 OK in 5ms (Views: 1.4ms | ActiveRecord: 2.8ms)
2013-03-01T07:23:32+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"Ins", "_"=>"1362122601836"}
2013-03-01T07:23:32+00:00 app[web.1]: Rendered posts/_search.html.erb (0.7ms)
2013-03-01T07:23:32+00:00 app[web.1]: Rendered posts/archive.js.erb (1.0ms)
2013-03-01T07:23:32+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=Inst&_=1362122601837" for 69.181.104.85 at 2013-03-01 07:23:32 +0000
2013-03-01T07:23:32+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:32+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"Inst", "_"=>"1362122601837"}
2013-03-01T07:23:32+00:00 app[web.1]: Rendered posts/_search.html.erb (0.8ms)
2013-03-01T07:23:32+00:00 app[web.1]: Completed 200 OK in 6ms (Views: 1.6ms | ActiveRecord: 3.4ms)
2013-03-01T07:23:32+00:00 app[web.1]: Rendered posts/archive.js.erb (1.1ms)
2013-03-01T07:23:32+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=Inst&_=1362122601837 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=2ms service=18ms status=200 bytes=218
2013-03-01T07:23:33+00:00 app[web.1]: Started GET "/archive?utf8=%E2%9C%93&search=Insta&_=1362122601838" for 69.181.104.85 at 2013-03-01 07:23:33 +0000
2013-03-01T07:23:33+00:00 app[web.1]: Processing by PostsController#archive as JS
2013-03-01T07:23:33+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "search"=>"Insta", "_"=>"1362122601838"}
2013-03-01T07:23:33+00:00 app[web.1]: Completed 200 OK in 5ms (Views: 1.4ms | ActiveRecord: 2.9ms)
2013-03-01T07:23:33+00:00 app[web.1]: Rendered posts/archive.js.erb (1.0ms)
2013-03-01T07:23:33+00:00 app[web.1]: Rendered posts/_search.html.erb (0.7ms)
2013-03-01T07:23:33+00:00 heroku[router]: at=info method=GET path=/archive?utf8=%E2%9C%93&search=Insta&_=1362122601838 host=<my_site>.com fwd="69.181.104.85" dyno=web.1 queue=0 wait=0ms connect=2ms service=15ms status=200 bytes=218
同样,虽然开发搜索工作得很好,而且我认为通常可以预期,但在生产中,上面发生的情况是:列表缩小,直到我在“blg”中输入 g,此时没有更多列表项目。当我删除“go”并输入“og”时,列表没有重新扩展以合并标题中带有“blog”的项目。当我删除搜索框中的所有字母时,它也没有包含所有内容。
搜索仅在我输入“I”时重置,并且因为 Instant 实际上是列表中的一个术语,所以它缩小到名称包含“Insta”的一个项目。
太奇怪了。有什么想法吗?