curationexperts / trove

Digital Image Library based on Tufts repository models
0 stars 2 forks source link

TuftsImage 'prefiltering' results in blank solr doc #174

Closed mark-dce closed 10 years ago

mark-dce commented 10 years ago

This is totally weird...

Starting with an absolutely clean jetty and creating images through the mira web UI or console:

REQUEST http://localhost:3005/records/new?utf8=✓&type=TuftsImage&pid=tufts%3Aaah.1&commit=Next

ERROR

RSolr::Error::Http in RecordsController#new
RSolr::Error::Http - 400 Bad Request Error: {'responseHeader'=>{'status'=>400,'QTime'=>0},'error'=>
{'msg'=>'Document is missing mandatory uniqueKey field: id','code'=>400}} Request Data: "<?xml 
version=\"1.0\" encoding=\"UTF-8\"?><add><doc/></add>" Backtrace: /Users/mark/.rvm/gems/ruby-
2.1.2@tufts/gems/rsolr-1.0.10/lib/rsolr/client.rb:283:in `adapt_response' /Users/mark/.rvm/gems/ruby-
2.1.2@tufts/gems/rsolr-1.0.10/lib/rsolr/client.rb:190:in `execute' /Users/mark/.rvm/gems/ruby-
2.1.2@tufts/gems/rsolr-1.0.10/lib/rsolr/client.rb:176:in `send_and_receive' (eval):2:in `post' 
/Users/mark/.rvm/gems/ruby-2.1.2@tufts/gems/rsolr-1.0.10/lib/rsolr/client.rb:82:in `update' 
/Users/mark/.rvm/gems/ruby-2.1.2@tufts/gems/rsolr-1.0.10/lib/rsolr/client.rb:102:in `add' 
/Users/mark/.rvm/gems/ruby-2.1.2@tufts/gems/active-fedora-
7.1.0/lib/active_fedora/solr_service.rb:141:in `add' /Users/mark/.rvm/gems/ruby-2.1.2@tufts/gems/active-
fedora-7.1.0/lib/active_fedora/indexing.rb:72:in `update_index' /Users/mark/.rvm/gems/ruby-
2.1.2@tufts/gems/active-fedora-7.1.0/lib/active_fedora/persistence.rb:174:in `persist' 
/Users/mark/.rvm/gems/ruby-2.1.2@tufts/gems/active-fedora-7.1.0/lib/active_fedora/callbacks.rb:236:in 
`block in persist' /Users/mark/.rvm/gems/ruby-2.1.2@tufts/gems/activesupport-
4.0.5/lib/active_support/callbacks.rb:423:in `_run__4082167158561223087__save__callbacks'

Extracted source (around line #24):
22      else
23        @record = params[:type].constantize.new(args)
24        @record.save(validate: false)
25        redirect_to next_page
26      end
27    else
mark-dce commented 10 years ago

Digging further, tufts_models has a strange to_solr method for TuftsImages: https://github.com/curationexperts/tufts_models/blob/master/app/models/tufts_image.rb#L13-L20

I have no idea what functionality that's supposed to provide, but it prevents new objects being created by MIRA with pids matching any of those patterns because the to_solr method returns an empty hash as the solr doc.

This code appears to come out of some earlier version of tdl_hydra_head. For comparison, there's something slightly newer in https://github.com/TuftsUniversity/tuftsification-hydra/commit/ab4d5acf86991ee3e50414f4b171f156fd668fec

Yet another argument for not having models defined in multiple places that need to act on the same objects.

mark-dce commented 10 years ago

It looks like the initial intent of the code in question was to prevent things being indexed into DL. We should talk to Mike K. about the possibility of putting filters in place in the various apps to ensure they only show content targeted for that head.

Example filtering displays for T-DIL: https://github.com/curationexperts/tufts-image-library/blob/master/app/controllers/catalog_controller.rb#L174-L177

acozine commented 10 years ago

Based on conversations with Mike K. 9/22/14 we are leaving the indexing exception code unchanged. DL filters for displays:dl but also handles legacy objects with no displays: setting. Each Tufts hydra head currently has its own Solr index and moving to a shared index is not immediately feasible.

Artifact images will be re-imported via MIRA for use in T-DIL. The image quality will be better, the metadata will conform to MIRA standards, and the PIDs will be autogenerated. So the issue with aah pids will be irrelevant in MIRA and T-DIL going forward.

We have removed objects with aah pids from the fixture list for testing MIRA and T-DIL.