• 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

12.5
/marc_to_solr/lib/geo.rb
1
# geo.rb
2
# extract geo-related data from MARC
3

4
def decimal_coordinate record
1✔
UNCOV
5
  coverage = []
×
UNCOV
6
  Traject::MarcExtractor.cached('034defg').collect_matching_lines(record) do |field, _spec, _extractor|
×
UNCOV
7
    c = {}
×
UNCOV
8
    field.subfields.each do |s_field|
×
UNCOV
9
      c['w'] = s_field.value if (s_field.code == 'd') && valid_coordinate_format?(s_field.value, record)
×
UNCOV
10
      c['e'] = s_field.value if (s_field.code == 'e') && valid_coordinate_format?(s_field.value, record)
×
UNCOV
11
      c['n'] = s_field.value if (s_field.code == 'f') && valid_coordinate_format?(s_field.value, record)
×
UNCOV
12
      c['s'] = s_field.value if (s_field.code == 'g') && valid_coordinate_format?(s_field.value, record)
×
13
    end
UNCOV
14
    if c.length != 4
×
15
      # turning of geo coordinate logging for now
16
      # logger.error "#{record['001']} - missing coordinate"
UNCOV
17
      break
×
18
    end
19

UNCOV
20
    coverage << "northlimit=#{c['n']}; eastlimit=#{c['e']}; southlimit=#{c['s']}; westlimit=#{c['w']}; units=degrees; projection=EPSG:4326"
×
21
  end
22
  # turning of geo coordinate logging for now
23
  # logger.error "#{record['001']} - multiple 034s" if coverage.length > 1
UNCOV
24
  coverage.first
×
25
end
26

27
def valid_coordinate_format? c, _record
1✔
UNCOV
28
  return false unless /^[-+]?[0-9]*\.?[0-9]+$/.match?(c)
×
29

UNCOV
30
  true
×
31
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