[英]Are module imports treated differently by vite in development and production?
[英]AJAX Search functions differently in development/production
我在我的應用程序中添加了即時搜索功能。
它完全按照我希望在本地服務器上的方式工作:
在生產中,這種行為是完全怪異的。 雖然它也可以進行按鍵搜索,但是它存在許多奇怪的問題。
知道這里發生了什么嗎? 為什么兩者不同? 我該如何解決? 讓我知道什么樣的代碼可能有助於解釋。
我的代碼:
archive.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>
archive.js.erb
$("#list").html("<%= escape_javascript(render("search")) %>");
posts_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()
routes.rb
match '/search', to: 'posts#search'
match '/archive', to: 'posts#archive'
編輯為了提供一些線索,我正在兩種環境中執行相同的用戶行為並發布博客。 我要做的是:
開發日志
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”的一項。
太奇怪了。 有什么想法嗎?
這種(析取)最終只是一個數據庫問題。
我正在運行sqlite開發和postgresql生產,兩者對我的搜索方法的響應不同。 當我將開發切換到pg時,在兩種環境中搜索都同樣失敗,因此我決定使用Think Sphinx而不是自制的解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.