• 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

35.0
/marc_to_solr/lib/indigenous_languages.rb
1
# frozen_string_literal: true
2

3
# Identify materials in indigenous languages
4
# from the Western Hemisphere
5
module IndigenousLanguages
1✔
6
  def in_an_indigenous_language?(record)
1✔
UNCOV
7
    language_extractor = LanguageExtractor.new(record)
×
UNCOV
8
    language_extractor.all_language_codes.any? { |code| language_codes.include? code } ||
×
UNCOV
9
      language_extractor.possible_language_subject_headings.any? { |heading| subject_headings.include? heading }
×
10
  end
11

12
  def subject_headings
1✔
UNCOV
13
    @subject_headings ||= fetch_subject_headings_from_file
×
14
  end
15

16
  def language_codes
1✔
UNCOV
17
    @language_codes ||= fetch_language_codes_from_file
×
18
  end
19

20
  private
1✔
21

22
    def fetch_subject_headings_from_file
1✔
UNCOV
23
      column_name = 'LCSH for indigenous languages'
×
UNCOV
24
      csv = CSV.read(File.join(File.dirname(__FILE__), 'augment_the_facet', 'indigenous_languages_western_hemisphere_lcsh.csv'), headers: true)
×
UNCOV
25
      unless csv.headers.include? column_name
×
26
        raise "Invalid CSV format, must have a column named \"#{column_name}\" containing LCSH"
×
27
      end
28

UNCOV
29
      csv[column_name]
×
30
    end
31

32
    def fetch_language_codes_from_file
1✔
UNCOV
33
      csv = CSV.read(File.join(File.dirname(__FILE__), 'augment_the_facet', 'indigenous_languages_western_hemisphere_codes.csv'), headers: true)
×
UNCOV
34
      column_contents = csv[csv.headers.first]
×
UNCOV
35
      column_contents.select { |entry| entry&.length == 3 }
×
36
                     .uniq
37
    end
38
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