Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude migrated records from recently published #557

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/recently_added.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def self.feed
solr = RSolr.connect(url: solr_url)
solr_params = {
q: '*:*',
fq: 'migrated_bsi:false',
sort: 'pdc_created_at_dtsi desc'
}
response = solr.get('select', params: solr_params)
Expand Down
3 changes: 3 additions & 0 deletions lib/traject/pdc_describe_indexing_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
accumulator.concat ["pdc_describe"]
end

# Was this record migrated?
to_field 'migrated_bsi', extract_xpath("/hash/resource/migrated")

# to_field 'abstract_tsim', extract_xpath("/item/metadata/key[text()='dcterms.abstract']/../value")
# to_field 'creator_tesim', extract_xpath("/item/metadata/key[text()='dcterms.creator']/../value")
to_field 'contributor_tsim' do |record, accumulator, _c|
Expand Down
3 changes: 2 additions & 1 deletion spec/fixtures/files/bitklavier_binaural.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@
"type": "CONTACT_PERSON"
}
],
"funders": []
"funders": [],
"migrated": true
},
"files": [
{
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/files/pppl1.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
}
],
"domains": [],
"migrated": true
"migrated": false
},
"files": [],
"group": {
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/files/pppl3.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
}
],
"domains": [],
"migrated": true
"migrated": false
},
"files": [],
"group": {
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/describe_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
expect(indexed_record["publisher_ssim"].first).to eq "Princeton University"
end

it "migrated_bsi" do
expect(indexed_record["migrated_bsi"]).to eq true
end

xit 'referenced_by' do
expect(result['referenced_by_ssim'].first).to eq 'https://arxiv.org/abs/1903.06605'
end
Expand Down
8 changes: 6 additions & 2 deletions spec/models/recently_added_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
response = Blacklight.default_index.connection.get 'select', params: { q: '*:*' }
response["response"]["docs"].first
end
let(:feed) { described_class.feed }

before do
Blacklight.default_index.connection.delete_by_query("*:*")
Blacklight.default_index.connection.commit
Expand All @@ -22,12 +24,14 @@
end

it "returns a payload of the most recent items with required fields" do
feed = described_class.feed
expect(feed.count).to eq 3
expect(feed.first.title).to eq "Lower Hybrid Drift Waves During Guide Field Reconnection"
expect(feed.first.authors_et_al).to eq "Yoo, Jongsoo et al."
expect(feed.first.genre).to eq "Dataset"
expect(feed.first.issued_date).to eq "2020"
end
it 'excludes migrated works' do
# there are 3 items in the index, but only 2 are not migrated
expect(feed.count).to eq 2
end
end
# rubocop:enable RSpec/ExampleLength