Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Created June 13, 2013 21:12
Show Gist options
  • Select an option

  • Save jcoyne/5777417 to your computer and use it in GitHub Desktop.

Select an option

Save jcoyne/5777417 to your computer and use it in GitHub Desktop.
Collections in solr
f = GenericFile.first
=> #<GenericFile pid:"scholarsphere:r49507488"...
> f.collections
=> []
> c = Collection.new
=> #<Collection pid:""...
> c.apply_depositor_metadata('jcoyne')
=> true
> c.save
=> true
> c.pid
=> "scholarsphere:5m60rj293"
> f.collections = [c]
=> [#<Collection pid:"scholarsphere:5m60rj293", depositor:"jcoyne", date_uploaded:Thu, 13 Jun 2013, date_modified:Thu, 13 Jun 2013, title:nil, description:nil>]
> f.save
=> true
f.to_solr['collection_sim']
=> ["scholarsphere:5m60rj293"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment