Keeping Fedora and Solr in sync

35 views
Skip to first unread message

drhinehart

unread,
Oct 5, 2010, 5:45:05 PM10/5/10
to ActiveFedora / Ruby + Fedora Commons
Is there a way to keep the Solr index in sync with what's actually in
Fedora? I purged some objects using Fedora's web interface and found
that these objects still existed inside of Solr's index. Is there a
script or plugin for Fedora that would post the document xml to Solr
so that the index is updated?

Thanks,
Dave

Rick Johnson

unread,
Oct 6, 2010, 8:38:52 AM10/6/10
to active...@googlegroups.com
Hi Dave,

  Yes, because Fedora is not really aware of what ActiveFedora is putting in Solr, it does not delete anything from there when you delete an object through the Fedora admin UI.  Anytime we want to delete something we have done it through ActiveFedora instead.  If you want to just delete one or two items a quick way would be to do it through the rails console.  You just create the object and then call delete on itself:

  1. cd to your app workspace
  2. script/console
  3. require "rubygems"
  4. require "active-fedora"
  5. ActiveFedora.init
  6. obj = ActiveFedora::Base.load_instance("changeme:1")
  7. obj.delete
  Just replace "ActiveFedora::Base" with your model class if you have extended it and replace "changeme:1" with your pid and you should be set.  Now because you already deleted something from Fedora and not Solr you will probably need to recreate it first in the Fedora Admin console in order for ActiveFedora to load the object.  Then, you should be able call delete like above and it will be removed from both Solr and Fedora.

  Alternatively, if you have a lot of objects to do you could build a rake task that takes inputs etc.  We also have an ingest controller that sits within our application to take ingest/remove requests with REST calls.

Thanks,
Rick

----------------------------------------------------------
Rick Johnson
Unit Manager, Digital Library Applications and Local Programming Unit
Library Information Systems
University of Notre Dame
Michiana Academic Library Consortium
Notre Dame, IN USA 46556
http://www.library.nd.edu
574-631-1086
------------------------------------------------------------


--
You received this message because you are subscribed to the Google Groups "ActiveFedora / Ruby + Fedora Commons" group.
To post to this group, send email to active...@googlegroups.com.
To unsubscribe from this group, send email to active-fedor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/active-fedora?hl=en.


Reply all
Reply to author
Forward
0 new messages