Search code examples
solrsunspot

Can I continue solr indexing if an error occurs due to bad data instead of abort


We are using Primero and it uses Solr for search.

Below is the command to reindex

RAILS_ENV=production bundle exec rake sunspot:reindex --trace

However, we get an error due to bad data that is hard to find. Is it possible to not abort and continue reindexing on error?

Error message

rake aborted!
ArgumentError: invalid date

Also, is it possible to get a detailed error?

Any help is appreciated.


Solution

  • The problem was with the error handling in sunspot package.

    There was a bad date entry empty space for one of the records that failed when Date.parse() tried to parse the date.

    I had to debug the sunspot code to figure out the field that resulted in this issue. After correcting the record reindexing worked.