• 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

42.31
/marc_to_solr/lib/language_extractor.rb
1
# A class to pull out language information from
2
# a MARC record
3
class LanguageExtractor
1✔
4
  def initialize(marc_record)
1✔
UNCOV
5
    @marc_record = marc_record
×
6
  end
7

8
  def all_language_codes
1✔
UNCOV
9
    all_041_codes.append(fixed_field_code).compact.uniq
×
10
  end
11

12
  def possible_language_subject_headings
1✔
UNCOV
13
    @marc_record.fields('650')
×
UNCOV
14
                .select { |field| field['v']&.match(/^texts/i) }
×
UNCOV
15
                .map { |field| field['a'] }
×
16
  end
17

18
  def fixed_field_code
1✔
UNCOV
19
    value = @marc_record['008']&.value
×
UNCOV
20
    fixed_field_code = value ? value[35, 3] : nil
×
21
  end
22

23
  def iso_041_fields
1✔
UNCOV
24
    all_041_fields.select { |field| field['2'] == 'iso639-3' }
×
25
  end
26

27
  def all_041_fields
1✔
UNCOV
28
    @marc_record.fields('041')
×
29
  end
30

31
  def iso_041_codes
1✔
UNCOV
32
    return [] unless iso_041_fields.any?
×
33

UNCOV
34
    extract_from_multiple_041s(iso_041_fields)
×
35
  end
36

37
  def all_041_codes
1✔
UNCOV
38
    return [] unless all_041_fields.any?
×
39

UNCOV
40
    extract_from_multiple_041s(all_041_fields)
×
41
  end
42

43
  private
1✔
44

45
    def extract_from_multiple_041s(fields)
1✔
UNCOV
46
      fields.map do |field|
×
UNCOV
47
        field.subfields.select { |sf| %(a d).include? sf.code }
×
48
             .map(&:value)
49
      end.flatten
50
    end
51
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