Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #389 from sul-dlss/index-type
Browse files Browse the repository at this point in the history
Index the object type
  • Loading branch information
mjgiarlo committed Nov 28, 2018
2 parents b87d3f3 + 5d98f36 commit bd03ed8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/dor/indexers/data_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ def initialize(resource:)
@resource = resource
end

# we need to override this until https://github.com/samvera/active_fedora/pull/1371
# has been released
def to_solr(solr_doc = {}, opts = {})
super.tap do |doc|
doc['active_fedora_model_ssi'] = has_model
end
end

# rubocop:disable Naming/PredicateName
def has_model
resource.class.inspect
end
# rubocop:enable Naming/PredicateName

delegate :create_date, :modified_date, :state, :pid, :inner_object,
:datastreams, :relationships, to: :resource
end
Expand Down
14 changes: 14 additions & 0 deletions spec/models/item_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Dor::Item do
describe '#to_solr' do
subject(:doc) { item.to_solr }
let(:item) { described_class.new(pid: 'foo:123') }

before { allow(Dor::Config.workflow.client).to receive(:get_milestones).and_return([]) }

it { is_expected.to include 'active_fedora_model_ssi' => 'Dor::Item' }
end
end

0 comments on commit bd03ed8

Please sign in to comment.