Reindexing fails after upgrading solr - ruby-on-rails

I used sunspot_solr and sunspot_rails gem that integrates solr 4 from the following link..
source
Now, when i try to reindex the existing documents, i get a status 500, Internal Server Error..
I removed solr directory and after bundle install, and gave the following commands
rails generate sunspot_rails:install
rake sunspot:solr:run
where am i going wrong? :/
when i tried to reindex in rails console, i got the following error...
when i tried reindexing in rails console, i got the following error..
RSolr::Error::Http: RSolr::Error::Http - 500 Internal Server Error
Error: {'responseHeader'=>{'status'=>500,'QTime'=>10},'error'=>{'trace'=>'java.lang.NullPointerException
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:232)
at org.apache.solr.update.AddUpdateCommand.getLuceneDocument(AddUpdateCommand.java:73)
at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:204)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69)
at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51)
at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:451)
at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:587)
at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:346)
at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:100)
at org.apache.solr.handler.loader.XMLLoader.processUpdate(XMLLoader.java:246)

The stopwords were causing the problems... i had to do some changes in the schema.xml(as i used ngrams in my project) and fixed the stopwards problem.. now its working fine :)

Related

Error when trying to run rails server (Gemfile not found)

I've ran into a error that haven't happened before and haven't found a real solution online. Everytime I try to run a rails command like rails server or rails generate scaffold I get the following error:
D:/myrailsapp/config/.../Gemfile not found
Any ideas how to fix this? I had it working after the error without doing anything and now I can't run it again.
It might be related to this https://github.com/RailsApps/rails-composer/issues/138
try running
gem update

searchkick Index missing in ruby application

Im trying to use Searchkick in my application. However, I get
Searchkick::MissingIndexError
Index missing - run Product.reindex
def search
if params[:search].present?
#product = Product.search(params[:search])
else
#product = Product.all
end
I run Produc.reindex but it didn't solve the issue. I also tried following : rake searchkick:reindex:all and I receive the Reindex complete message which is followed by rake db:migrate; however,I come up with the same missing index error when I submit the search query.
any advice and suggestions will be greatly appreciated
Using Rails 4.1.8 and Elastic Search 2.4.6, I was facing this same problem in the production environment, and when I tried to access the action URL of the autocomplete action I was receiving the same Index missing - run Product.reindex error message. However, in development environment Elastic Search was working without problems.
Usually, I use the following command to reindex my class:
rake searchkick:reindex CLASS=Product
So, following #Aref Aslani comment, I tried this command:
RAILS_ENV=production rake searchkick:reindex CLASS=Product
And it worked!
You can simply launch your Rails Console and then type
Product.reindex
I had a similar error in my application and so I just decided to understand the error message and then tried it on the console as if I am testing a feature and it worked perfectly.
I got same issue in the rails development environment, Rails 5.2.3, ruby 2.4.0, so
resolved it by using the following command:
rails searchkick:reindex CLASS=<ClassName>
like
rails searchkick:reindex CLASS=ThreeDGarment

SOLR - sunspot_rails/sunspot_solr 2.1 - NO JSP support

I'm currently using the master branch of the sunspot_rails/sunspot_solr gem and when I run bundle exec rake sunspot:solr:run the following error occurs:
2013-12-22 14:46:48.884:INFO:oejw.StandardDescriptorProcessor:NO JSP Support for /solr, did not find org.apache.jasper.servlet.JspServlet
Null identity service, trying login service: null
Finding identity service: null
How do I go about rectifying this error and thereby enabling JSP support for my Rails SOLR environment?
Furthermore my bundle exec rake sunspot:solr:reindex command is causing the below errors on each index attempt:
14:48:06
SEVERE
SolrCore
java.lang.NullPointerException
java.lang.NullPointerException
14:48:06
SEVERE
SolrDispatchFilter
null:java.lang.NullPointerException
null:java.lang.NullPointerException
I'm assuming that the initial JSP support error is causing my indexing to fail.
Any help in the right direction appreciated.
I ended up ditching SOLR in favour of Elasticsearch. I found the setup for SOLR was too much of a hassle, for both development and production, and it had very limited configuration options.
You can download and install the Elasticsearch service at their official site: http://www.elasticsearch.org.
In order to use the search service with Rails, just include the gem in your application gemfile:
gem 'searchkick'
You can also find more information on how to configure your instance on their Github wiki: https://github.com/ankane/searchkick/blob/master/README.md
Hope this proves helpful!
I had similar problem when upgrading to sunspot_solr 2.2. Here's how I solved the issue:
bundle install
Delete /solr directory completely since solr/config/solrconfig.xml, solr/data, and other files are outdated.
bundle exec rails generate sunspot_rails:install
bundle exec rake sunspot:solr:run # this will recreate your /solr directory with its config and other files
bundle exec rake sunspot:reindex

Error while running ruby script/server

I got an error while running ruby script/server,
DRb::DRbConnError in HomeController#index
druby://localhost:3333 - #
Iam not able to understand where is the exact error, is there any gem missing or server issue.
I don't know what the ruby app you are trying to start is supposed to do but it seems to use a DRB server, which you would have to start before.

Asset Pipeline Issue Upgrading Rails 3.0 app to Rails 3.2

I've followed the instructions for the Railscast on upgrading a Rails app to 3.1:
http://railscasts.com/episodes/282-upgrading-to-rails-3-1?view=asciicast
The server doesn't recognize requests for any folders within app/assets.
Just to be sure, I've run rake rails:update and diff'd the files against what we have. It looks like every old config flag has been removed and every new config flag has been set.
When I load the homepage, I see the following in the javascript console:
"NetworkError: 404 Not Found - http://localhost:3000/assets/application.js"
"NetworkError: 404 Not Found - http://localhost:3000/assets/application.css"
Does anyone have any suggestions? I'm completely stumped, short of creating a new app and moving things over.
The issue was with the active_reload gem in our project. Disabling it in the gemfile and running bundle install fixed the issue
Apparently the first statement on the project page is that it's incompatible with Rails 3.2.x.

Resources