sunspot / sunspot Goto Github PK
View Code? Open in Web Editor NEWSolr-powered search for Ruby objects
Home Page: http://sunspot.github.com/
License: MIT License
Solr-powered search for Ruby objects
Home Page: http://sunspot.github.com/
License: MIT License
I was using sunspot 1.2.1
( with Windows 7 64bit ) before this and everything ran correctly but when I installed 1.3.0.
and ran rake sunspot:solr:run
I get this error:
The syntax of the command is incorrect.
rake aborted!
You need a Java Runtime Environment to run the Solr server
I also tried to use:
gem "sunspot", "2.0.0.pre.111215"
group :development do
gem "sunspot_solr", "~> 2.0.0.pre.111215"
end
This gives me the same error. Any ideas?
sunspot_rails no longer loads when using Bundler to install it from GitHub (using a git source in Gemfile):
gem 'sunspot_rails', git: 'https://github.com/outoftime/sunspot.git'
Updating https://github.com/outoftime/sunspot.git
Fetching dependency information from the API at http://rubygems.org/.....
Bundler could not find find gem sunspot_rails (>= 0),which is required by gem progress_bar (= 0.3.4)
Appears that one or more commits over the past few days broke it.
It would be nice if we could access the debugQuery output without having to check the logs for search parameters and run searches against Solr manually.
- solr/
- conf/
- schema.xml
- solrconfig.xml
- etc…
- development/
- conf -> ../conf
- production
- conf -> ../conf
- test/
- conf -> ../conf
- solr.xml
<solr persistent="true" sharedLib="lib">
<cores adminPath="/admin/cores">
<core name="production" instanceDir="production" />
<core name="development" instanceDir="development" />
<core name="test" instanceDir="test" />
</cores>
</solr>
production:
solr:
hostname: localhost
port: 8983
path: /solr/production
log_level: WARNING
development:
solr:
hostname: localhost
port: 8983
path: /solr/development
log_level: INFO
test:
solr:
hostname: localhost
port: 8983
path: /solr/test
log_level: WARNING
Can we kill this and still maintain support for Rails >= 2.3?
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from searchable at /Users/alindeman/Documents/workspace/sunspot/sunspot_rails/lib/sunspot/rails/searchable.rb:70)
Make sure we no longer refer to will_paginate
, etc...
Hi,
Environment: Rails 3.1.1, Ruby 1.8.7 (REE)
Setup:
rails new app
cd app/
rails g model User name:string
rails g observer User
# add sunspot (master) to Gemfile:
gem 'sunspot_rails', :git => 'git://github.com/sunspot/sunspot.git'
group :test, :development do
gem 'sunspot_solr', :git => 'https://github.com/sunspot/sunspot.git'
end
bundle install
# add to config/application.rb:
config.active_record.observers = :user_observer
# add to app/models/user.rb:
searchable do
end
# add a simple text asset: app/assets/images/test.txt with content '.'
Now start up the app
rails c
And access the asset a few times:
for i in {1..500}; do curl http://localhost:3000/assets/test.txt; done
Watch the memory consumption of the server process rise. In a bigger app I can only load about 10 pages (with about 10 assets) before it needs about 1.5 GB. The problem goes away when I remove the "searchable" declaration from the User model or the observer line in config/application.rb.
Suggested DSL:
Post.search do
with(:location).in_bounding_box [32, -68], [33, -69]
end
http://wiki.apache.org/solr/SpatialSearch#bbox_-_Bounding-box_filter
Hi I really don't know who is the responsible of this error (RSolr, sunspot or sunspot_test)
Failure/Error: Unable to find matching line from backtrace
RSolr::Error::InvalidRubyResponse:
RSolr::Error::InvalidRubyResponse - 200 OK
Request Data:
<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>*:*</query></delete>
Backtrace: /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/rsolr-1.0.6/lib/rsolr/client.rb:256:in `rescue in evaluate_ruby_response' /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/rsolr-1.0.6/lib/rsolr/client.rb:253:in `evaluate_ruby_response' /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/rsolr-1.0.6/lib/rsolr/client.rb:228:in `adapt_response' /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/rsolr-1.0.6/lib/rsolr/client.rb:164:in `execute' /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/rsolr-1.0.6/lib/rsolr/client.rb:158:in `send_and_receive' (eval):2:in `post' /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/rsolr-1.0.6/lib/rsolr/client.rb:67:in `update' /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/rsolr-1.0.6/lib/rsolr/client.rb:131:in `delete_by_query' /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/sunspot-1.3.0/lib/sunspot/indexer.rb:57:in `remove_all' /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/sunspot-1.3.0/lib/sunspot/session.rb:178:in `remove_all' /Users/mauroasprea/.rvm/gems/ruby-1.9.3-p0/gems/sunspot-1.3.0/lib/sunspot/session.rb:189:in `remove_all!'
I'm getting this when running a rails integration_test of my search controller. In my gemfile I have the following gems:
rsolr (1.0.6)
sunspot (1.3.0)
rspec (2.7.0)
sunspot_test (0.4.0)
guard (0.9.4)
database_cleaner (0.7.0)
vcr (2.0.0.rc1)
I am trying to pass a simple test that saves a model instance (using Factory girl), with its corresponding search block and it searches it later.
Help please?
Solr 4.0 feature: http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance
I am getting the following error:
undefined method `[]' for nil:NilClass
On line #11 of app/views/admin/lead_searches/_results.html.erb
11: <%= sunspot_will_paginate(@leads.hits) %>
sunspot (1.2.1) lib/sunspot/search/hit.rb:30:in `initialize'
sunspot (1.2.1) lib/sunspot/search/abstract_search.rb:84:in `new'
sunspot (1.2.1) lib/sunspot/search/abstract_search.rb:84:in `hits'
sunspot (1.2.1) lib/sunspot/search/abstract_search.rb:83:in `map'
sunspot (1.2.1) lib/sunspot/search/abstract_search.rb:83:in `hits'
app/views/admin/lead_searches/_results.html.erb:11
sunspot_will_paginate is pretty simple ...
def sunspot_will_paginate(hits)
unless hits.blank?
will_paginate(
hits,
:renderer => "RemoteLinkRenderer",
:remote => {:before => "$('spinner').show();", :complete => "$('spinner').hide();"}
)
end
end
It just renders a ajax pagination list
What I don't understand is how something could be nil here:
https://github.com/sunspot/sunspot/blob/master/sunspot/lib/sunspot/search/hit.rb#L30
Any thoughts? It was fixed by re-indexing the records. What could have been nil?
~ Tom
Hi,
my colleague on OSX Snow Leopard and me on OSX Lion recently updated our system to the newest Java update. Since this we receive in development mode a connection refused error.
SOLR Request (1.4ms) [ path=#<RSolr::Client:0x000001089021e0> parameters={data: fq=type%3AJobOffer&fq=started_at_d%3A%5B%2A+TO+2011%5C-11%5C-16T13%5C%3A40%5C%3A07Z%5D&fq=ended_at_d%3A%5B2011%5C-11%5C-16T13%5C%3A40%5C%3A07Z+TO+%2A%5D&sort=ranked_at_d+desc&start=0&rows=20&q=%2A%3A%2A, method: post, params: {:wt=>:ruby}, query: wt=ruby, headers: {"Content-Type"=>"application/x-www-form-urlencoded"}, path: select, uri: http://localhost:8982/solr/select?wt=ruby} ]
Completed 500 Internal Server Error in 23ms
Errno::ECONNREFUSED (Connection refused - connect(2)):
The server seems to work correctly
4446 ?? 0:03.80 /usr/bin/java -Dsolr.data.dir=/var/folders/j0/h6j1w2px233bb_g2461l8pnr0000gn/T -Dsolr.solr.home=/Users/XXXXX/.rvm/gems/ruby-1.9.2-p180/bundler/gems/sunspot-a32d14da2650/sunspot_solr/solr/solr -jar start.jar
Development configuration:
Gemfile:
gem 'rails', '3.0.10'
gem 'pg'
gem 'sunspot_rails', :git => 'https://github.com/sunspot/sunspot.git'
[...]
group :development, :test do
gem 'sunspot_solr', :git => 'https://github.com/sunspot/sunspot'
[...]
end
Since my colleague and me are both receiving this error after both updating Java on OS X we believe that this may be a possible reason.
Can someone confirm this or give us a hint to repair?
I'm trying to get more_like_this
to work, but I'm getting this error:
undefined method `more_like_this_fields' for nil:NilClass
Here is my searchable config:
searchable do
integer :id
text :title, :boost => 5, :more_like_this => true
boolean :hidden
integer :site_id
end
Here is my call to more_like_this:
@posts = Sunspot.more_like_this(post) do
fields :title
with(:site_id, post.site.id)
with(:hidden, false)
end
Here's a full trace:
activesupport (3.0.9) lib/active_support/whiny_nil.rb:48:in `method_missing'
sunspot (1.3.0) lib/sunspot/dsl/more_like_this_query.rb:12:in `fields'
sunspot (1.3.0) lib/sunspot/dsl/more_like_this_query.rb:11:in `each'
sunspot (1.3.0) lib/sunspot/dsl/more_like_this_query.rb:11:in `fields'
sunspot (1.3.0) lib/sunspot/util.rb:241:in `__send__'
sunspot (1.3.0) lib/sunspot/util.rb:241:in `__proxy_method__'
sunspot (1.3.0) lib/sunspot/util.rb:236:in `method_missing'
app/cells/related_posts_cell.rb:67:in `by_likenes'
sunspot (1.3.0) lib/sunspot/util.rb:208:in `instance_eval'
sunspot (1.3.0) lib/sunspot/util.rb:208:in `instance_eval_with_context'
sunspot (1.3.0) lib/sunspot/util.rb:86:in `instance_eval_or_call'
sunspot (1.3.0) lib/sunspot/search/abstract_search.rb:210:in `build'
sunspot (1.3.0) lib/sunspot/session.rb:73:in `new_more_like_this'
sunspot (1.3.0) lib/sunspot/session.rb:81:in `more_like_this'
sunspot (1.3.0) lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `more_like_this'
sunspot (1.3.0) lib/sunspot.rb:381:in `more_like_this'
app/cells/related_posts_cell.rb:66:in `by_likenes'
actionpack (3.0.9) lib/abstract_controller/base.rb:150:in `send_action'
actionpack (3.0.9) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.9) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.0.9) lib/active_support/callbacks.rb:431:in `_run__1998484214__process_action__1837307674__callbacks'
activesupport (3.0.9) lib/active_support/callbacks.rb:410:in `send'
activesupport (3.0.9) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.9) lib/active_support/callbacks.rb:94:in `send'
activesupport (3.0.9) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.9) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.9) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.9) lib/abstract_controller/rendering.rb:41:in `process'
cells (3.6.2) lib/cell/rails.rb:30:in `render_state'
cells (3.6.2) lib/cell/caching.rb:88:in `render_state'
cells (3.6.2) lib/cell.rb:21:in `render_cell_for'
cells (3.6.2) lib/cells/rails.rb:53:in `render_cell'
app/views/posts/show.html.erb:85:in `_app_views_posts_show_html_erb___910203779_2174137360_0'
actionpack (3.0.9) lib/action_view/helpers/capture_helper.rb:40:in `capture'
actionpack (3.0.9) lib/action_view/helpers/capture_helper.rb:172:in `with_output_buffer'
actionpack (3.0.9) lib/action_view/helpers/capture_helper.rb:40:in `capture'
actionpack (3.0.9) lib/action_view/helpers/capture_helper.rb:137:in `content_for'
app/views/posts/show.html.erb:55:in `_app_views_posts_show_html_erb___910203779_2174137360_0'
actionpack (3.0.9) lib/action_view/template.rb:135:in `send'
actionpack (3.0.9) lib/action_view/template.rb:135:in `render'
activesupport (3.0.9) lib/active_support/notifications.rb:54:in `instrument'
actionpack (3.0.9) lib/action_view/template.rb:127:in `render'
actionpack (3.0.9) lib/action_view/render/rendering.rb:59:in `_render_template'
activesupport (3.0.9) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.9) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.9) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.9) lib/action_view/render/rendering.rb:56:in `_render_template'
actionpack (3.0.9) lib/action_view/render/rendering.rb:26:in `render'
actionpack (3.0.9) lib/abstract_controller/rendering.rb:115:in `_render_template'
actionpack (3.0.9) lib/abstract_controller/rendering.rb:109:in `render_to_body'
actionpack (3.0.9) lib/action_controller/metal/renderers.rb:47:in `render_to_body'
actionpack (3.0.9) lib/action_controller/metal/compatibility.rb:55:in `render_to_body'
actionpack (3.0.9) lib/abstract_controller/rendering.rb:102:in `render_to_string'
actionpack (3.0.9) lib/abstract_controller/rendering.rb:93:in `render'
actionpack (3.0.9) lib/action_controller/metal/rendering.rb:17:in `render'
actionpack (3.0.9) lib/action_controller/metal/instrumentation.rb:40:in `render'
activesupport (3.0.9) lib/active_support/core_ext/benchmark.rb:5:in `ms'
/Users/thomas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/benchmark.rb:308:in `realtime'
activesupport (3.0.9) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.0.9) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (3.0.9) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime'
activerecord (3.0.9) lib/active_record/railties/controller_runtime.rb:15:in `cleanup_view_runtime'
sunspot_rails (1.3.0) lib/sunspot/rails/railties/controller_runtime.rb:15:in `cleanup_view_runtime'
actionpack (3.0.9) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.0.9) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.0.9) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.0.9) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.9) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.9) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.0.9) lib/active_support/callbacks.rb:451:in `_run__84203013__process_action__453433196__callbacks'
activesupport (3.0.9) lib/active_support/callbacks.rb:410:in `send'
activesupport (3.0.9) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.9) lib/active_support/callbacks.rb:94:in `send'
activesupport (3.0.9) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.9) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.9) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.9) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.9) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.9) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.9) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.9) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.9) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.9) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.9) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.9) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.9) lib/action_controller/metal.rb:178:in `action'
actionpack (3.0.9) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.9) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.9) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:859:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.9) lib/action_dispatch/routing/route_set.rb:493:in `call'
omniauth (1.0.0) lib/omniauth/strategy.rb:168:in `call!'
omniauth (1.0.0) lib/omniauth/strategy.rb:148:in `call'
omniauth (1.0.0) lib/omniauth/builder.rb:30:in `call'
warden (1.0.5) lib/warden/manager.rb:35:in `call'
warden (1.0.5) lib/warden/manager.rb:34:in `catch'
warden (1.0.5) lib/warden/manager.rb:34:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.4) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.9) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.9) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.9) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.9) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.9) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.4) lib/rack/sendfile.rb:106:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.9) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.4) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.9) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.4) lib/rack/lock.rb:11:in `call'
rack (1.2.4) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.4) lib/rack/lock.rb:11:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.9) lib/rails/application.rb:168:in `call'
railties (3.0.9) lib/rails/application.rb:77:in `send'
railties (3.0.9) lib/rails/application.rb:77:in `method_missing'
/Users/thomas/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:146:in `handle'
/Users/thomas/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:99:in `start'
/Users/thomas/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:86:in `each'
/Users/thomas/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:86:in `start'
/Users/thomas/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:66:in `loop'
/Users/thomas/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:66:in `start'
/Users/thomas/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:13:in `run'
/Users/thomas/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/bin/nack_worker:4
I'm using sunspot for my app, and I'm running into a strange issue after upgrading from 1.2.0 to the latest RC from the master branch of the repo (no other changes to the app, just the Gemfile).
After running the bundle command i get
Using sunspot (1.3.0.rc3) from https://github.com/sunspot/sunspot.git (at master)
Using sunspot_rails (1.3.0.rc3) from https://github.com/sunspot/sunspot.git (at master)
which looks ok.
Everything looks and works fine until the search stumbles on a result with non ascii chars.
The error i get is
Encoding::UndefinedConversionError in BooksController#index "\xC3" from ASCII-8BIT to UTF-8
which points to somewhere in a helper where i just display the values of facets.
I checked the encoding of those values before and after the upgrade and they are different:
everything is on UTF-8 with 1.2 and everything is on ASCII-8BIT with 1.3
Does anyone have and idea about what's going on?
Thank you
Marco
http://stackoverflow.com/questions/8032643/sunspot-facets-on-location
If anyone can help me with that, it'd be great!
Basically, I want to do something like:
with(:coordinates).near(coord[0], coord[1], :precision => 3)
facet :distance do
row 2 do
with(:coordinates).near(coord[0], coord[1], :precision => 2)
end
row 3 do
with(:coordinates).near(coord[0], coord[1], :precision => 3)
end
end
But I get: undefined method near for #<Sunspot::DSL::Restriction:[...]>
Any idea?
Thanks
This issue is to document the breaking or somewhat breaking changes that need to be addressed for folks upgrading from 1.3 to 2.0
schema.xml
changes for geospatialrake sunspot:reindex
Hi, following the example in the README about goups I have this error
NoMethodError: undefined method `results' for #<Sunspot::Search::FieldGroup
s = Event.search do
group(:name_str) do
limit 5
end
fulltext("amanecer")
end
s.groups.each do |group|
group.results.each do |result|
puts result
end
end
How could I get the grouped results for a group?
When running the rake task to stop sunspot's solr server, the process should not throw an exception and halt if the PID process is not currently running.
The whole point is that we want the server to stop; if the process is not running, it is in essense stopped, and we can just log a message/warning to that effect and proceed on to remove said PID file and continue.
I'd be happy to submit the patch for this if the mods are agreeable.
Its looks like mwmitchell has changed the namespacing for the adapters module in rsolr sometime after 0.9.1 and the gem dependency in the gemspec is >= 0.8.9
Consider:
$ rake sunspot:reindex
rake aborted!
Connection refused - connect(2)
Why not…?
$ rake sunspot:reindex
!!! Could not connect to Solr at http://localhost:8983/solr
rake aborted!
Connection refused - connect(2)
Hi,
I have a model called Page and it has has_many relationships to another model called Asset. My Asset model has a Carriewave declaration has_attached_file :document (file attachement to the Page model) . Below are my models:
class Asset < ActiveRecord::Base
belongs_to :page
has_attached_file :document
end
class Page < ActiveRecord::Base
has_many :assets, :dependent => :destroy
searchable :if => :published do
text :title , :stored => true , :boost => 2.0
text :body , :stored => true , :boost => 2.0
end
end
When I run this command: bundle exec rake sunspot:solr:reindex --trace
I got this error::
** Invoke sunspot:solr:reindex (first_time)
** Invoke sunspot:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:reindex
rake aborted!
undefined method has_attached_file' for #<Class:0x000001032f0ae0> /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.10/lib/active_record/base.rb:1014:in
method_missing'
/Users/jc/netspace/documentation_sitecss/ukhls_documentation_paul/app/models/asset.rb:4:in <class:Asset>' /Users/jc/netspace/documentation_sitecss/ukhls_documentation_paul/app/models/asset.rb:1:in
<top (required)>'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in require' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in
block in require'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:227:in load_dependency' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in
require'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:30:in block (3 levels) in <top (required)>' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:30:in
each'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:30:in block (2 levels) in <top (required)>' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in
call'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in block in execute' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in
each'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in execute' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:158:in
block in invoke_with_call_chain'
/Users/jc/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in
invoke_with_call_chain'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:176:in block in invoke_prerequisites' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:174:in
each'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:174:in invoke_prerequisites' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:157:in
block in invoke_with_call_chain'
/Users/jc/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in
invoke_with_call_chain'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:144:in invoke' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:112:in
invoke_task'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in block (2 levels) in top_level' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in
each'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in block in top_level' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in
standard_exception_handling'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:84:in top_level' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:62:in
block in run'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:59:in
run'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in <top (required)>' /Users/jc/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in
load'
/Users/jc/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `
not sure what's going on, can someone help please.
Many thanks, Jeannette
Extract searchable
and methods like .search
, etc.. from sunspot_rails
into sunspot
and make it available to anyone using Sunspot.
In sunspot_rails
, we should simply include the module into ActiveRecord::Base
automatically.
Firstly, the Highlight#format
method doesn't play nicely with Rails 3 HTML dirty/safe escaping.
search_hit.highlight(field).format{ |term| content_tag(tag, term) }
The above will generate a dirty string that will be escaped again in the view. The user would have to call html_safe
against this output string to bypass that, which is, surprise, unsafe.
The above might be fine for non-Rails pure-Ruby apps. So let's leave #format
in place. But what we should do for the sake of Rails is play nicely with ActionView::Helpers::TextHelper#highlight
. To do so, it would be best to simply return an array of phrases to pass to the highlight
method.
Here's a hack in a demo app of mine which uses the ActionView highlight method, and is html-safe.
def highlighted(search_hit, field, tag=:strong)
phrases = search_hit.highlights(:name).map do |highlight|
highlight.instance_eval { @highlight }.scan(/@@@hl@@@([^@]+)@@@endhl@@@/)
end.flatten
highlight search_hit.stored(field).first, phrases
end
Rather than do all that work to instance_eval
and scan
the highlights, we should create a new method on Sunspot::Search::Hit
to return all the highlight phrases, for use with ActionView::Helpers::TextHelper#highlight
.
Because the ActionView highlight method is annoyingly naive, and rather defeats the point of Solr highlighting in many ways, here's what I've come up with instead. It combines highlighted sections, and uses safe_join
to interpolate in highlight start and end tags. Not super flexible (the is hard coded right now), and requires a Rails helper.
I'm not necessarily opposed to bundling in some view helpers.
HL_BEG = '@@@HL_BEG@@@'
HL_END = '@@@HL_END@@@'
# highlight the phrase with special markers,
# collapse multiple adjacent highlights
# and insert tags safely and sanitarily
def smart_highlight(search_hit, field, tag=:em)
# mark the string to be highlighted
marked = search_hit.highlight(field).format do |phrase|
"#{HL_BEG}#{phrase}#{HL_END}"
end
# collapse adjacent
marked.gsub("#{HL_END} #{HL_BEG}", ' ')
# interpolate highlighting tags with sanitization
highlighted = safe_join(marked.split(HL_BEG), "<#{tag} class='highlight'>".html_safe)
highlighted = safe_join(highlighted.split(HL_END), "</#{tag}>".html_safe)
end
Bug was detected as a difference between console output and app output
I have 2 cases
#case 1 - finds results, fails to find highights
@search = Sunspot.search(search_options[:classes]) do
fulltext params[:q], :hightlight => true
end
#case 2 - finds results with highlights
@search = Sunspot.search(search_options[:classes]){ fulltext params[:q], :highlight => true; }
As you see - nothing really different.
ruby 1.9.2p290 (2011-07-09 revision 32553)
rails 3.1
sunspot_rails-1.2.1
outoftime/sunspot
are changed to sunspot/sunspot
I've been playing around with the latest Solr (3.4.0), and the edismax
handler in development, and it's pretty sweet. Essential even, if your app tries to support sophisticated queries.
Any plans on switching over Sunspot's dismax.rb
to use edismax
soon? Or perhaps just making it configurable?
Here's the monkey-patch I'm thinking about rolling out while we wait:
OriginalDismax = Sunspot::Query::Dismax
class PatchedDismax < OriginalDismax
def to_params
params = super
params[:defType] = 'edismax'
params
end
def to_subquery
query = super
query = query.sub '{!dismax', '{!edismax'
query
end
end
Sunspot::Query.send :remove_const, :Dismax
Sunspot::Query::Dismax = PatchedDismax
23:26:30 solr.1 | WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead.
23:26:30 solr.1 | at /Users/username/.rvm/gems/ruby-1.8.7-p352/gems/sunspot_rails-1.2.1/lib/sunspot/rails/tasks.rb:41
Right now we are indexing two "identifying" fields per document
id
is a mashup of "#{class_name} #{primary_key}"
class_name
is pretty self explanatory.We should also add a primary_key
field while we're at it for various conveniences.
Consider: you have a bunch of integer primary keys, and would like to remove these documents en masse without instantiating each of them.
Currently you'd have to fake that id
string.
ids = (100..200).map { |i| "Post #{i}" }
Sunspot.remove(Post) do
with(:id, ids)
end
…but it would be nice to be able to be more direct in the syntax.
ids = 100..200
Sunspot.remove(Post) do
with(:primary_key, ids)
end
Marked as a Sunspot 2.0 feature because it'll require a schema change.
The "sunspot_rails" gem would be more appropriately named "sunspot_activerecord", since it is specific to ActiveRecord. However, much of the functionality could be used with other ORMs/ODMs, like MongoMapper and Mongoid. It would be great to see the Rails (or maybe ActiveModel) functionality in one gem and the ActiveRecord functionality in another. That way, gems like https://github.com/balexand/sunspot_mongo could depend on the sunspot_rails gem without pulling in ActiveRecord as a dependency.
When running rake tasks on heroku reindexing fails with:
negative argument
Looking at the trace, progress_bar
seems to be at fault:
** Invoke sunspot:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:reindex
rake aborted!
negative argument
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:97:in `*'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:97:in `render_bar'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:87:in `send'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:87:in `render'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:72:in `to_s'
/app/.bundle/gems/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:254:in `inject'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:71:in `each'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:71:in `inject'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:71:in `to_s'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:35:in `write'
/app/.bundle/gems/ruby/1.8/gems/progress_bar-0.4.0/lib/progress_bar.rb:28:in `increment!'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:260:in `solr_index'
/app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/relation/batches.rb:69:in `find_in_batches'
/app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/base.rb:446:in `__send__'
/app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/base.rb:446:in `find_in_batches'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:254:in `solr_index'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:198:in `solr_reindex'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:54
/app/.bundle/gems/ruby/1.8/gems/sunspot-1.3.0/lib/sunspot/class_set.rb:16:in `each'
/app/.bundle/gems/ruby/1.8/gems/sunspot-1.3.0/lib/sunspot/class_set.rb:16:in `each'
/app/.bundle/gems/ruby/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:53
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/ruby1.8.7/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/bin/rake:32
/app/.bundle/gems/ruby/1.8/bin/rake:19:in `load'
/app/.bundle/gems/ruby/1.8/bin/rake:19
Tasks: TOP => sunspot:reindex
Removing progress_bar
from my production gem group seems to fix the issue. Odd.
It would be nice to have feedback when reindexing on heroku.
When indexing the records like this
searchable do
text :description, :as => :desc_lvl1
text :search, :as => :search_lvl1
text :description, :as => :desc_lvl2
text :search, :as => :search_lvl2
end
with the purpose of applying different filters to the same field, sunspot only indexes and searches the last two times these fields are mentioned, apparently because it sees each of the original field names (:description and :search) duplicated, so it only honors the last time each of them is mentioned.
When doing a full text search in this scenario
search = self.solr_search do
fulltext term
end
The resulting query is
+(desc_lvl2:SKRL | search_lvl2:SKRL) ()
it does not include desc_lvl1 and search_lvl1.
After upgrading from 1.2 to 1.3, and start to run rails(3.1.3), it throws an error of
method_missing': undefined method `searchable' for # Class:0x007fd3a9140170 (NoMethodError)
Do I need to change someting?
A ruby Range created with ..
is inclusive on both ends. A range created with ...
is exclusive on its latter end.
>> (1...3).to_a
=> [1, 2]
>> (1..3).to_a
=> [1, 2, 3]
Currently, Sunspot treats these both as inclusive — foo:[1 TO 3]
— presumably because Solr does not currently support mixed range queries.
However, Solr 4.0 will support mixed inclusive/exclusive range queries — foo:[1 TO 3}
— as per https://issues.apache.org/jira/browse/LUCENE-996
Sunspot should take advantage of this to generate mixed inclusive/exclusive range queries.
Also, as per #165, greater_than
et al are a misnomer in Sunspot, because they generate a range rather than a mathematical greater-than. Perhaps we can revisit and clarify our vocabulary around the generation of range queries.
do i have to make +2 queries to determine min/max value for each facet with ranges every time or there is more proper way to do it?
thanx
I installed sunspot_rails 1.3.0.rc2, but I can't even start the solr server.
It's my rake sunspot:solr:start --trace:
** Invoke sunspot:solr:stop (first_time)
** Invoke environment (first_time)
** Execute environment
Warning: No memcahded
** Execute sunspot:solr:stop
rake aborted!
uninitialized constant Sunspot::Rails::Server
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/sunspot_rails-1.3.0.rc2/lib/sunspot/rails/tasks.rb:23:in `block (3 levels) in '
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/raincole/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/bin/rake:32:in `'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/home/raincole/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `'
Tasks: TOP => sunspot:solr:stop
I also tried 1.3.0.rc3, 1.3.0.rc4 but the results are the same. The problem was solve immediately after I turned back to 1.2.1 version.
It would be useful if named query facets and their rows could be used just like regular fields, this way one would just have to pass in the facet+row name to the DSL after the user selected a facet row.
I.e.
Sunspot.search(Class) do
facet(:foo) do
row(:bar1) do
with(:baz, 42)
end
row(:bar2) do
with(:baz, 2)
end
end
with(:foo,:bar2)
end
WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead.
at ~/.rvm/gems/ruby-1.9.2-p290/gems/sunspot_rails-1.2.1/lib/sunspot/rails/tasks.rb:41:in `block in <top (required)>'
this code is on the front page of the website but it has an error:
string :sort_title do
name.downcase.gsub(/^(an?|the)/, '')
end
with this regex things titled 'The Whatever' will have a leading space which will float it to the top, and things titled 'American Whatever' will float to the m's because the A will get stripped off the title. The trailing space is mandatory.
string :sort_title do
name.downcase.gsub(/^(an?|the)\ /, '')
end
See gist for queueing resque jobs in ActiveRecord objects: https://gist.github.com/1282013
Sunspot::Resque::Update
and Sunspot::Resque::Remove
.:resque
option on searchable
which sets auto_index: false, auto_remove: false
and mixes in the Resque after_commit
and before_destroy
hooks.This could feed its way into a more generic approach to how the index and remove calls are invoked. We could use generic after_commit
and before_destroy
hooks to invoke Resque, DelayedJob, or synchronous calls, based on our sensible defaults and the user's preferences.
I'm working with Rails 3.1.0 and I have an object with a default_scope that does not order object's by ID. Rather than ignoring scoped order and limit (which is what the .index method puts to STDOUT when run from console, the method clearly takes that scoped order into account because the object.id jumps from 0 to 502705 in one 50 object batch.
class MasterFile < ActiveRecord::Base
default_scope :order => ['unit_id DESC, filename ASC']
....
end
Here is the output from the rails console:
ruby-1.9.2-p290 :003 > MasterFile.index
Scoped order and limit are ignored, it's forced to be batch order and batch size
MasterFile Load (2006.8ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` >= 0) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:16 -0400] Start Indexing
[2011-10-03 17:53:16 -0400] Completed Indexing. Rows indexed 0. Rows/sec: 266.10606987945397 (Elapsed: 0.187895 sec.)
MasterFile Load (9.7ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 502705) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:16 -0400] Start Indexing
[2011-10-03 17:53:16 -0400] Completed Indexing. Rows indexed 50. Rows/sec: 468.16041048304794 (Elapsed: 0.106801 sec.)
MasterFile Load (9.1ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 502755) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:16 -0400] Start Indexing
[2011-10-03 17:53:16 -0400] Completed Indexing. Rows indexed 100. Rows/sec: 405.0255571126538 (Elapsed: 0.123449 sec.)
MasterFile Load (14.8ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 502805) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:16 -0400] Start Indexing
[2011-10-03 17:53:17 -0400] Completed Indexing. Rows indexed 150. Rows/sec: 463.06586648884934 (Elapsed: 0.107976 sec.)
MasterFile Load (17.7ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 502855) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:17 -0400] Start Indexing
[2011-10-03 17:53:17 -0400] Completed Indexing. Rows indexed 200. Rows/sec: 422.25093528582164 (Elapsed: 0.118413 sec.)
MasterFile Load (10.7ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 502915) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:17 -0400] Start Indexing
[2011-10-03 17:53:17 -0400] Completed Indexing. Rows indexed 250. Rows/sec: 410.17900211652363 (Elapsed: 0.121898 sec.)
MasterFile Load (10.7ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 502965) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:17 -0400] Start Indexing
[2011-10-03 17:53:17 -0400] Completed Indexing. Rows indexed 300. Rows/sec: 486.75064737836107 (Elapsed: 0.102722 sec.)
MasterFile Load (7.6ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 503015) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:17 -0400] Start Indexing
[2011-10-03 17:53:17 -0400] Completed Indexing. Rows indexed 350. Rows/sec: 491.5840805411358 (Elapsed: 0.101712 sec.)
MasterFile Load (8.5ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 503065) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:17 -0400] Start Indexing
[2011-10-03 17:53:17 -0400] Completed Indexing. Rows indexed 400. Rows/sec: 428.68411125210054 (Elapsed: 0.116636 sec.)
MasterFile Load (9.5ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 503115) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:17 -0400] Start Indexing
[2011-10-03 17:53:18 -0400] Completed Indexing. Rows indexed 450. Rows/sec: 409.7688903458449 (Elapsed: 0.12202 sec.)
MasterFile Load (11.2ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 503165) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:18 -0400] Start Indexing
[2011-10-03 17:53:18 -0400] Completed Indexing. Rows indexed 500. Rows/sec: 385.5258186640759 (Elapsed: 0.129693 sec.)
MasterFile Load (9.9ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 503215) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:18 -0400] Start Indexing
[2011-10-03 17:53:18 -0400] Completed Indexing. Rows indexed 550. Rows/sec: 415.62068793536264 (Elapsed: 0.120302 sec.)
MasterFile Load (7.9ms) SELECT `master_files`.* FROM `master_files` WHERE (`master_files`.`id` > 503265) ORDER BY unit_id DESC, filename ASC, `master_files`.`id` ASC LIMIT 50
[2011-10-03 17:53:18 -0400] Start Indexing
[2011-10-03 17:53:18 -0400] Completed Indexing. Rows indexed 600. Rows/sec: 702.4247703071002 (Elapsed: 0.071182 sec.)
=> nil
After removing default_scope, the indexing job proceeded perfectly.
Hi,
When I run rake sunspot:reindex --trace
on sunspot 1.3.0.rc6 I get the following error:
** Invoke sunspot:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:reindex
Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile
rake aborted!
undefined method `solr_reindex' for #<Class:0x007fa21c5f3500>
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/base.rb:1088:in `method_missing'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/sunspot_rails-1.3.0.rc6/lib/sunspot/rails/tasks.rb:54:in `block (3 levels) in <top (required)>'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/sunspot-1.3.0.rc6/lib/sunspot/class_set.rb:16:in `each'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/sunspot-1.3.0.rc6/lib/sunspot/class_set.rb:16:in `each'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/sunspot_rails-1.3.0.rc6/lib/sunspot/rails/tasks.rb:53:in `block (2 levels) in <top (required)>'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/task.rb:205:in `call'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/task.rb:205:in `block in execute'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/task.rb:200:in `each'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/task.rb:200:in `execute'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/tute/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/task.rb:144:in `invoke'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/application.rb:114:in `invoke_task'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/application.rb:93:in `block in top_level'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/application.rb:93:in `each'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/application.rb:93:in `top_level'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/application.rb:66:in `block in run'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/application.rb:131:in `standard_exception_handling'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/lib/rake/application.rb:63:in `run'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.3.beta.1/bin/rake:37:in `<top (required)>'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `load'
/Users/tute/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `<main>'
Tasks: TOP => sunspot:reindex
How can I fix it? Meanwhile, does Sunspot.index(Model.all) work in the same way, or how do I rebuild the index?
Thanks in advance,
Tute.
When I use the v0.10 branch to use localsolr the facet options are not used in the search.
When I use the "near" method with the "with" method, the results are not filtered with the facet inputs.
The sub method in Kernel is only activated in 1.9.x when the -n or -p flags are used. Unfortunately, this is not the case in ruby < 1.9. When trying to use a sub (subtraction) Solr function the following error will be produced
TypeError: $_ value need to be String (nil given)
This can be easily demonstrated by changing the "should handle arbitrary functions" in function_spec.rb to use "sub" instead of "product" and running in 1.8.7
it "should handle arbitrary functions in a function query block" do
session.search Post do
keywords('pizza') do
boost(function { sub(:average_rating, 10) })
end
end
connection.should have_last_search_including(:bf, 'sub(average_rating_ft,10)')
end
This can be corrected by monkeypatching Object but I am hesitant to recommend that
class Object
def sub *args
if $_
endsuper.sub *args
else
method_missing :sub, *args
end
end
end
We have not determined if any other Solr function names conflict with Object or Kernel methods.
I'm using sunspot_rails 1.3.0 and sunspot_solr 1.3.0. Rails 2.3.14.
In my Rakefile, I am loading:
require 'sunspot/rails/tasks'
When I try to run rake sunspot:solr:start
, it gives me the 'Note: This task has been moved to the sunspot_solr gem' error. When I remove require 'sunspot/solr/tasks'
, the command works just fine; however, I lose the ability to run rake sunspot:solr:reindex
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.