• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / bibdata / f04bc944-f9b4-4a42-8b26-dcacd0e3e688

11 Mar 2025 10:27PM UTC coverage: 34.017% (-58.1%) from 92.162%
f04bc944-f9b4-4a42-8b26-dcacd0e3e688

Pull #2653

circleci

christinach
Add new lc_subject_facet field.
Helps with the vocabulary work https://github.com/pulibrary/orangelight/pull/3386
In this new field we index only the lc subject heading and the subdivisions
So that when the user searches using the Details section, they can query solr for
all the subject headings and their divisions.

This is needed for the Subject browse Vocabulary work.
example: "lc_subject_facet": [
             "Booksellers and bookselling—Italy—Directories",
             "Booksellers and bookselling-Italy",
             "Booksellers and bookselling"
              ]
Pull Request #2653: Add new lc_subject_facet field.

1 of 3 new or added lines in 1 file covered. (33.33%)

2215 existing lines in 93 files now uncovered.

1294 of 3804 relevant lines covered (34.02%)

0.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.19
/marc_to_solr/lib/action_note_builder.rb
1
class ActionNoteBuilder
1✔
2
  attr_reader :record
1✔
3

4
  def initialize(record:)
1✔
UNCOV
5
    @record = record
×
6
  end
7

8
  def self.build(record:)
1✔
UNCOV
9
    new(record:).build
×
10
  end
11

12
  def build
1✔
UNCOV
13
    notes = []
×
14

UNCOV
15
    @record.fields('583').each do |field|
×
UNCOV
16
      public_note = field.indicator1 == '1'
×
UNCOV
17
      field_link = field['8']
×
UNCOV
18
      next unless public_note && (field_link.present? || pulfa_record? || scsb_record?)
×
19

UNCOV
20
      notes << { description: description(field), uri: uri(field) }
×
21
    end
UNCOV
22
    notes = [notes.to_json.to_s] if notes.present?
×
UNCOV
23
    notes.presence
×
24
  end
25

26
  private
1✔
27

28
    def description(field)
1✔
UNCOV
29
      description = ''
×
UNCOV
30
      description << materials_specified(field)
×
UNCOV
31
      description << action(field)
×
UNCOV
32
      description << action_interval(field)
×
UNCOV
33
      description << authorization_phrase(field)
×
UNCOV
34
      description << institution(field)
×
35
    end
36

37
    def uri(field)
1✔
UNCOV
38
      return '' if field['u'].blank?
×
39

UNCOV
40
      field['u'].strip
×
41
    end
42

43
    def action(field)
1✔
UNCOV
44
      return '' if field['a'].blank?
×
45

UNCOV
46
      field['a']&.upcase_first
×
47
    end
48

49
    def action_interval(field)
1✔
UNCOV
50
      return '' if field['d'].blank?
×
51

UNCOV
52
      " #{field['d']}"
×
53
    end
54

55
    def authorization_phrase(field)
1✔
UNCOV
56
      return '' if field['f'].blank?
×
57

UNCOV
58
      auth_array = authorization_array(field)
×
UNCOV
59
      auth_phrase = ''
×
UNCOV
60
      first_auth = auth_array.shift
×
UNCOV
61
      auth_phrase << " — #{first_auth}"
×
UNCOV
62
      auth_array.each do |auth|
×
UNCOV
63
        auth_phrase << " #{auth}"
×
64
      end
UNCOV
65
      auth_phrase
×
66
    end
67

68
    def authorization_array(field)
1✔
UNCOV
69
      field.subfields.select { |s_field| s_field.code == 'f' }.map(&:value)
×
70
    end
71

72
    def institution(field)
1✔
UNCOV
73
      return '' if field['5'].blank?
×
74

UNCOV
75
      " (#{field['5']})"
×
76
    end
77

78
    def materials_specified(field)
1✔
UNCOV
79
      return '' if field['3'].blank?
×
80

UNCOV
81
      "#{field['3']}: "
×
82
    end
83

84
    def pulfa_record?
1✔
UNCOV
85
      @pulfa_record ||= @record.fields('035').select { |f| f['a']&.downcase =~ /pulfa/ }.present?
×
86
    end
87

88
    def scsb_record?
1✔
UNCOV
89
      @scsb_record ||= scsb_doc?(@record['001']&.value)
×
90
    end
91
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc