Coder Social home page Coder Social logo

spree-solr-search's Introduction

Solr Search

Installation

  1. add gem 'acts_as_solr_reloaded', :git => 'git://github.com/dcrec1/acts_as_solr_reloaded.git'
  2. Add gem "spree_solr_search", :git => 'git://github.com/romul/spree-solr-search.git' to your Gemfile
  3. Run bundle install
  4. Run rails g spree_solr_search:install

Master branch 1.0.x - 1.2.x compatible.
If you want use this extension with Spree 0.10.x or 0.11.x, then you should use spree-0-11-stable branch.

Usage

To download, set up and start Solr 3.6:

bundle exec rake solr:download
bundle exec rake solr:start

To perform the indexing:

bundle exec rake solr:reindex BATCH=500

To stop Solr demo-server:

bundle exec rake solr:stop

To configure production Solr server:

edit RAILS_ROOT/config/solr.yml

Running rake tasks in background

Read instructions how to run rake tasks in background.

spree-solr-search's People

Contributors

danmorin avatar divineforest avatar iloveitaly avatar jumph4x avatar laurens avatar romul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

spree-solr-search's Issues

spree_solr_search breaks rake db:migrate

After adding spree_solr_search to a spree project (spree version "0.50.99"), rake db:migrate on an empty database does not work:

$ RAILS_ENV=production rake db:migrate --trace
Requiring REXML
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Table 'rails_application_production.products' doesn't exist
/ruby/default/gems/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:312:in `query'
/ruby/default/gems/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:312:in `execute'
/ruby/default/gems/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:462:in `columns'
/ruby/default/gems/gems/activerecord-3.0.4/lib/active_record/base.rb:679:in `columns'
/ruby/default/gems/gems/activerecord-3.0.4/lib/active_record/base.rb:687:in `columns_hash'
/ruby/default/gems/gems/acts_as_solr_reloaded-1.5.0/lib/acts_as_solr/acts_methods.rb:351:in `type_for_field'
/ruby/default/gems/gems/acts_as_solr_reloaded-1.5.0/lib/acts_as_solr/acts_methods.rb:344:in `determine_field_name_and_options'
/ruby/default/gems/gems/acts_as_solr_reloaded-1.5.0/lib/acts_as_solr/acts_methods.rb:296:in `get_field_value'
/ruby/default/gems/gems/acts_as_solr_reloaded-1.5.0/lib/acts_as_solr/acts_methods.rb:320:in `process_fields'
/ruby/default/gems/gems/acts_as_solr_reloaded-1.5.0/lib/acts_as_solr/acts_methods.rb:318:in `each'
/ruby/default/gems/gems/acts_as_solr_reloaded-1.5.0/lib/acts_as_solr/acts_methods.rb:318:in `process_fields'
/ruby/default/gems/gems/acts_as_solr_reloaded-1.5.0/lib/acts_as_solr/acts_methods.rb:282:in `process_solr_options'
/ruby/default/gems/gems/acts_as_solr_reloaded-1.5.0/lib/acts_as_solr/acts_methods.rb:190:in `process_acts_as_solr'
/ruby/default/gems/gems/acts_as_solr_reloaded-1.5.0/lib/acts_as_solr/acts_methods.rb:185:in `acts_as_solr'
/ruby/default/gems/gems/spree_solr_search-0.40.0/lib/../app/models/product_decorator.rb:6
/ruby/default/gems/gems/spree_solr_search-0.40.0/lib/../app/models/product_decorator.rb:1:in `class_eval'
/ruby/default/gems/gems/spree_solr_search-0.40.0/lib/../app/models/product_decorator.rb:1
/ruby/default/gems/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
/ruby/default/gems/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
/ruby/default/gems/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:227:in `load_dependency'
/ruby/default/gems/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
/ruby/default/gems/gems/spree_solr_search-0.40.0/lib/spree_solr_search.rb:17:in `activate'
/ruby/default/gems/gems/spree_solr_search-0.40.0/lib/spree_solr_search.rb:16:in `glob'
/ruby/default/gems/gems/spree_solr_search-0.40.0/lib/spree_solr_search.rb:16:in `activate'
/ruby/default/gems/gems/spree_solr_search-0.40.0/lib/spree_solr_search.rb:6:in `_callback_before_51'
/ruby/default/gems/gems/activesupport-3.0.4/lib/active_support/callbacks.rb:439:in `_run_prepare_callbacks'
/ruby/default/gems/gems/actionpack-3.0.4/lib/action_dispatch/middleware/callbacks.rb:40:in `initialize'
/ruby/default/gems/gems/actionpack-3.0.4/lib/action_dispatch/middleware/stack.rb:33:in `new'
/ruby/default/gems/gems/actionpack-3.0.4/lib/action_dispatch/middleware/stack.rb:33:in `build'
/ruby/default/gems/gems/actionpack-3.0.4/lib/action_dispatch/middleware/stack.rb:79:in `build'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/application.rb:208:in `inject'
/ruby/default/gems/gems/actionpack-3.0.4/lib/action_dispatch/middleware/stack.rb:79:in `each'
/ruby/default/gems/gems/actionpack-3.0.4/lib/action_dispatch/middleware/stack.rb:79:in `inject'
/ruby/default/gems/gems/actionpack-3.0.4/lib/action_dispatch/middleware/stack.rb:79:in `build'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/application.rb:162:in `build_middleware_stack'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/application/finisher.rb:35
/ruby/default/gems/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `instance_exec'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `run'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/initializable.rb:50:in `run_initializers'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `each'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `run_initializers'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/application.rb:134:in `initialize!'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/application.rb:77:in `send'
/ruby/default/gems/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'

This makes it impossible to set up a new instance of the app (using the instructions at https://github.com/spree/spree/blob/master/README.md) after spree_solr_search is added.

Problem with solr_search and spree-0.40

Hi,

I'm contacting you because I'm new with solr and spree, and you might be able to tell me straight away if I'm doing something wrong.

First, I'm using spree-0.40, there might be some compatibility issue. If so, please tell me what is needed to do, I'll start on this as soon as possible.

Then, my current problem:

Everything is installing fine, without particular problem on tomcat/solr/rails/rvm/passenger installation.

I'm trying the "rake solr:reindex BATCH=500" command, and I got this error:

Requiring REXML
** Invoke solr:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute solr:reindex
Clearing index for Product...
Rebuilding index for Product...
rake aborted!
400 "Bad Request"

In tomcat logs, I got this error:

==> catalina.2011-01-10.log <==
Jan 10, 2011 7:49:04 PM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: ERROR:unknown field 'brand_property_facet'
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:289)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:60)

On local install, I've got this other error:

Requiring REXML
** Invoke solr:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `set_preference' for nil:NilClass
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/whiny_nil.rb:48:in `method_missing'
/Library/Ruby/Gems/1.8/gems/spree_core-0.40.0/lib/spree/preference_access.rb:18:in `set'
/Library/Ruby/Gems/1.8/gems/spree_core-0.40.0/lib/spree/preference_access.rb:17:in `each'
/Library/Ruby/Gems/1.8/gems/spree_core-0.40.0/lib/spree/preference_access.rb:17:in `set'
/Library/Ruby/Gems/1.8/gems/spree_solr_search-0.30.0.beta1/lib/spree_solr_search.rb:11:in `activate'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `_callback_before_39'

full error: http://pastebin.com/MRMXtT7q

Thanks a lot for your help and your spree plugin.

Alex

Problem with (0.80) and(0.70.1) version

Hi sir

Thankyou for this wonderful plugin

But i am finding some problem in installing on (0.80) and(0.70.1) version.

When i executed rails g spree_solr_search:install command i am getting this error

/usr/local/lib/ruby/gems/1.9.1/gems/spree_solr_search-0.40.3/lib/spree/search/solr.rb:2:in `module:Search': uninitialized constant Spree::Search::Base (NameError)

Can u please check that?

problem using extension

I am running Spree 0.11.0 gem. I have installed spree-solr-search as an extension and copied the config to RAILS_ROOT/config. I also installed the recommended jetty-solr and started that process using the provided rake commands. I then logged into the console and tried a simple product search.

Using Product.keywords("foobaz") returns an error:

NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.map
from /home/dlazar/workspace/ct/vendor/extensions/solr_search/lib/spree/search/solr.rb:7:in `get_products_conditions_for'
from /usr/lib/ruby/gems/1.8/gems/spree-0.11.0/lib/scopes/product.rb:56

But using Product.search() works and returns an ActsAsSolr object with results.

Am I doing something wrong with how I've set things up to have the Product.keywords() method not work or is this something to do with Spree?

Thanks! I really hope to be able to figure out how to point search at Option Values since that is the best way to find relevant Products for my store.

Unable to install gem via rake task

All rake tasks fail if you do not have aas gem installed ("no such file to load -- acts_as_solr/tasks")

Change acts_as_solr.rake as follows:

if defined? Solr::Document 
  require "acts_as_solr/tasks"
end

undefined method `paginate' for #<Array:0x007fd814470420>

Hi when i do a search, the response is : undefined method `paginate' for #Array:0x007fd814470420.
I try change the row of file: spree-solr-search / lib / spree / search / solr.rb (https://github.com/romul/spree-solr-search/blob/master/lib/spree/search/solr.rb) : products = result.records.paginate(:page => page, :per_page => per_page, :total_entries => count) in products = result.records#.paginate(:page => page, :per_page => per_page, :total_entries => count) and it work but with out pagination.

For the configuration i follow your readme instruction in home page.

Interesting problem with solr_search

Hi,

Using solr_search as an extension to a 0.11 gem based site. I was writing a rake task to iterate all my products, do a gsub on the "name" attribute, and then call "save" method on the object.

Rake task blew out, as solr_search could not deal with . handing it a nil.[] object.

I had to take :all out of my Spree plugin load line in preinitializer.rb to get my rake task to run. I am now scares that ANY and all of my rake tasks dealing with Spree products will cause issues with Solr.

Is there some way to use rake tasks to CRUD Products without causing Solr to error out?

Thanks for any suggestions.

warning: already initialized constant RAILS_ROOT

After adding spree_solr_search to a spree app (spree version "0.50.99"), I get this warning:

/ruby/default/gems/gems/spree_solr_search-0.40.0/lib/../app/controllers/spree/base_controller_decorator.rb:3: warning: already initialized constant RAILS_ROOT

on every request made when running the app, as well as when running tests.

undefined method `facets' for #<Spree::Search::Solr:0x007fb7af7a3f00>

This is Ash Ganatra's bug report posted in the mailing list:

After installing spree-solr-search I run the reindexing which runs fine but when I try to load the site I get this error

NoMethodError in Spree/home#index
Showing /Users/ashga/code/webportal/spree_products_filter/app/views/spree/shared/_taxonomies.html.erb where line #2 raised:

undefined method `facets' for #<Spree::Search::Solr:0x007fb7af7a3f00>

Extracted source (around line #2):

1: <nav id="taxonomies" class="sidebar-item" data-hook><%
2: facets = @searcher.facets || []
3:   taxon_names = @taxon ? @taxon.self_and_descendants.map(&:name) : []
4:   for facet in facets  
5:     options = facet.options
Trace of template inclusion: /Users/ashga/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/spree-68fee9e06a3f/core/app/views/spree/home/index.html.erb

Fix EN locale

Please change en-US to en only inside the locale file.

Compatibility with spree_static_content extension

I am working on a project that uses this extension and spree_static_content. After getting this extension running all of my static content pages threw an error as follows:

ActionView::Template::Error (undefined method available_facets' for nil:NilClass): 1: <nav id="taxonomies" class="sidebar-item" data-hook><% 2: facets = @searcher.available_facets || [] 3: taxon_names = @taxon ? @taxon.self_and_descendants.map(&:name) : [] 4: for facet in facets 5: options = facet.options spree_core (1.3.2) app/views/spree/shared/_taxonomies.html.erb:2:in_ea1d5b61095c876e70e1dc33471f3255'

With a little digging I can see this error started showing up because of the override to put facets in the sidebar. spree_static_content's main controller inherits from Spree::StoreController and probably is not creating the corresponding @searcher variable that _facets.html.erb is expecting.

A conditional inside the facets partial solved this problem for me. That strikes me as more of a bandaid than an actual fix. Because other extensions may update/pollute/change the sidebar in spree it seems like the @searcher variable needs to be instantiated in a more persistant way? Unfortunately I do not know enough about this extension yet to say if that is worth doing or even the right solution.

I did publish my quick fix for this and can issue a pull request if you like:
Wootenblatz@e49fccd

Plugin 400 "Bad Request"

I am trying to use spree solr search plugin .Installation part worked
fine

But when i execute rake solr:reindex BATCH=500

Clearing index for Product...
rake aborted!
400 "Bad Request"

Tasks: TOP => solr:reindex

Can u please check that .

This is my log file

SEVERE: org.apache.solr.common.SolrException: org.apache.lucene.queryParser.ParseException: Cannot parse '{:rows=>25000, :start=>0, :operator=>nil, :facets=>{:limit=>-1, :mincount=>1, :fields=>["price_range_facet", "taxon_names_facet", "brand_property_facet", "color_option_facet", "size_option_facet"]}, :filter_queries=>[], :field_list=>["pk_s", "score"], :query=>"(sadasd AND is_active_t:(true)) AND (type_s:Product)"}': Encountered " <RANGEEX_GOOP> ":operator=>nil, "" at line 1, column 26.
Was expecting:
"}" ...

    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:108)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:174)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:679)

Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse '{:rows=>25000, :start=>0, :operator=>nil, :facets=>{:limit=>-1, :mincount=>1, :fields=>["price_range_facet", "taxon_names_facet", "brand_property_facet", "color_option_facet", "size_option_facet"]}, :filter_queries=>[], :field_list=>["pk_s", "score"], :query=>"(sadasd AND is_active_t:(true)) AND (type_s:Product)"}': Encountered " <RANGEEX_GOOP> ":operator=>nil, "" at line 1, column 26.
Was expecting:
"}" ...

    at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:205)
    at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:78)
    at org.apache.solr.search.QParser.getQuery(QParser.java:131)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:89)
    ... 17 more

Caused by: org.apache.lucene.queryParser.ParseException: Encountered " <RANGEEX_GOOP> ":operator=>nil, "" at line 1, column 26.
Was expecting:
"}" ...

    at org.apache.lucene.queryParser.QueryParser.generateParseException(QueryParser.java:1846)
    at org.apache.lucene.queryParser.QueryParser.jj_consume_token(QueryParser.java:1728)
    at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1538)
    at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1337)
    at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1265)
    at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1254)
    at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:200)
    ... 20 more

15 Dec, 2011 5:02:50 PM org.apache.solr.core.SolrCore execute
INFO: [core0] webapp=/solr path=/select/ params={indent=on&start=0&q={:rows%3D>25000,+:start%3D>0,+:operator%3D>nil,+:facets%3D>{:limit%3D>-1,+:mincount%3D>1,+:fields%3D>["price_range_facet",+"taxon_names_facet",+"brand_property_facet",+"color_option_facet",+"size_option_facet"]},+:filter_queries%3D>[],+:field_list%3D>["pk_s",+"score"],+:query%3D>"(sadasd+AND+is_active_t:(true))+AND+(type_s:Product)"}&rows=10&version=2.2} status=400 QTime=34
root@ispconfig:/var/www/giftonomics.empressem.in/s6/sp6#

Pagination Issue

Using spree-solr-search 1.4.0 with Spree 0.11.0, apache2, passenger, Ubuntu 10.04, Ruby 1.8.7. Also tested an verified on Mac OSX w/non-Apple Ruby 1.8.7 on RVM.

When searching for products, pagination works as expected, however when browsing taxons, pagination does not work. Upon further inspection, I put logging in right before and after the following line in /lib/spree/search.rb

curr_page = Spree::Config.searcher.manage_pagination ? 1 : params[:page]

Spree::Config.searcher.manage_pagination returns TRUE as e defined in solr_search/lib/spree/solr.rb prepare method as expected. The base search implementation does not implement the method, therefore searcher returns nil causing the params[:page] value to be used for pagination.

Browsing taxonomy tags appears to need the value to be nil, to properly do paging, while the search message requires true. If you want to see a live working example, I can send you links to the problem on my site.

Compatible with Spree 1.1?

So I was trying to find a way to message you about this, but I couldn't find it. :/ Apologies, since I'm sure that this is the wrong place for this, but here goes.

You say it's compatible with spree master branch 1.0. What do I need to do to get it to work with Spree 1.1?

Thanks. :)

Spree::ThemeSupport (NameError)

I got the following error installing spree-solr-search the way its described in the readme file. Using the git repository fixes the problem.

Requiring REXML
/home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/spree_solr_search-0.40.3/lib/spree_solr_search_hooks.rb:1:in `<top (required)>': uninitialized constant Spree::ThemeSupport (NameError)
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/spree_solr_search-0.40.3/lib/spree_solr_search.rb:2:in `<top (required)>'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `each'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `block in require'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
    from /home/matthias/public_html/spree_wandtasie/config/application.rb:7:in `<top (required)>'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.6/lib/rails/commands.rb:24:in `require'
    from /home/matthias/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.6/lib/rails/commands.rb:24:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Ruby 1.9.2 and libxml-ruby

Hey guys,

Just solved an issue with acts_as_solr_reloaded (dependency), the gem version of 1.5.0 might have the bug still.

To fix, include this before this extension (order wise) in your Gemfile:
gem "acts_as_solr_reloaded", :git => "git://github.com/dcrec1/acts_as_solr_reloaded.git"

The repository is of the author, so that's all good.
See this if curious: dcrec1/acts_as_solr_reloaded#11

spree_solr_search breaks RSpec 2.5 specs on Rails 3

By overriding ENV['RAILS_ENV'], https://github.com/romul/spree-solr-search/blob/master/lib/spree_solr_search.rb#L8 breaks running tests with RSpec 2.5. In particular, the spec/spec_helper.rb generated by RSpec contains the line:

ENV["RAILS_ENV"] ||= 'test'

Because of the conditional assignment, when spree_solr_search is added to a project, RAILS_ENV is always "development" when running tests, as engines are activated before spec/spec_helper.rb is loaded.

Among other things, this breaks loading of test-only gems with Bundler, so things like factory_girl, shoulda, and other gems which usually go in the test group do not get loaded.

Cannot modify SafeBuffer in place

Hello!

Please, tell me why don't work rake solr:reindex BATCH=500?
trace mistake:

Requiring REXML
Clearing index for Product...
Rebuilding index for Product...
rake aborted!
Cannot modify SafeBuffer in place

Tasks: TOP => solr:reindex
(See full trace by running task with --trace)
antonio@antonio-P5KC:~/my_spree_site$ rake solr:reindex BATCH=500 --trace
Requiring REXML
** Invoke solr:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute solr:reindex
Clearing index for Product...
Rebuilding index for Product...
rake aborted!
Cannot modify SafeBuffer in place
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.0.9/lib/active_support/core_ext/string/output_safety.rb:127:in gsub!' /home/antonio/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/text.rb:117:ininitialize'
/home/antonio/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/element.rb:494:in new' /home/antonio/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/element.rb:494:intext='
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/solr/field.rb:32:in to_xml' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/solr/document.rb:68:inblock in to_xml'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/solr/document.rb:68:in each' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/solr/document.rb:68:into_xml'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/acts_as_solr/instance_methods.rb:81:in to_solr_doc' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/acts_as_solr/class_methods.rb:219:inblock in rebuild_solr_index'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/acts_as_solr/class_methods.rb:219:in collect' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/acts_as_solr/class_methods.rb:219:inrebuild_solr_index'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/tasks/solr.rake:111:in block (3 levels) in <top (required)>' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/tasks/solr.rake:102:ineach'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/acts_as_solr_reloaded-1.6.0/lib/tasks/solr.rake:102:in block (2 levels) in <top (required)>' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:205:incall'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:205:in block in execute' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:200:ineach'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:200:in execute' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:158:inblock in invoke_with_call_chain'
/home/antonio/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/task.rb:144:in invoke' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:112:ininvoke_task'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:90:in block (2 levels) in top_level' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:90:ineach'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:90:in block in top_level' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:84:in top_level' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:62:inblock in run'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/lib/rake/application.rb:59:inrun'
/home/antonio/.rvm/gems/ruby-1.9.2-head/gems/rake-0.9.2/bin/rake:32:in <top (required)>' /home/antonio/.rvm/gems/ruby-1.9.2-head/bin/rake:19:inload'
/home/antonio/.rvm/gems/ruby-1.9.2-head/bin/rake:19:in `

'
Tasks: TOP => solr:reindex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.