• 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

40.0
/marc_to_solr/lib/hierarchical_heading.rb
1
# frozen_string_literal: true
2

3
# Generate hierarchical heading strings
4
# like German language—Foreign words and phrases
5
class HierarchicalHeading
1✔
6
  def initialize(field:, spec:, split_on_subfield:)
1✔
UNCOV
7
    @field = field
×
UNCOV
8
    @spec = spec
×
UNCOV
9
    @split_on_subfield = split_on_subfield
×
10
  end
11

12
  def to_s
1✔
UNCOV
13
    return unless any_subfields?
×
14

UNCOV
15
    compile_string
×
16
  end
17

18
  private
1✔
19

20
    def any_subfields?
1✔
UNCOV
21
      subfields.any?
×
22
    end
23

24
    def compile_string
1✔
UNCOV
25
      heading = Traject::Macros::Marc21.trim_punctuation(first_subfield.value)
×
UNCOV
26
      remaining_subfields.each do |subfield|
×
UNCOV
27
        heading << delimiter_for(subfield)
×
UNCOV
28
        heading << Traject::Macros::Marc21.trim_punctuation(subfield.value)
×
29
      end
UNCOV
30
      heading
×
31
    end
32

33
    def delimiter_for(subfield)
1✔
UNCOV
34
      @split_on_subfield.include?(subfield.code) ? SEPARATOR : ' '
×
35
    end
36

37
    def first_subfield
1✔
UNCOV
38
      subfields.first
×
39
    end
40

41
    def remaining_subfields
1✔
UNCOV
42
      subfields.drop(1)
×
43
    end
44

45
    def subfields
1✔
UNCOV
46
      @subfields ||= @field.subfields.select { |subfield| @spec.subfields.include? subfield.code }
×
47
    end
48
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