• 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.91
/marc_to_solr/lib/uri_ark.rb
1
# Class modeling the ARK standard for URL's
2
# @see https://tools.ietf.org/html/draft-kunze-ark-18
3
class URI::ARK < URI::Generic
1✔
4
  attr_reader :nmah, :naan, :name
1✔
5

6
  ARK_REGEX = %r{://(.+)/ark:/(.+)/(.+)/?}
1✔
7
  PRINCETON_ARK_REGEX = %r{[/?]ark:/88435/(.+)/?}
1✔
8

9
  # Constructs an ARK from a URL
10
  # @param url [URI::Generic] the URL for the ARK resource
11
  # @return [URI::ARK] the ARK
12
  def self.parse(url:)
1✔
UNCOV
13
    url = URI.parse(url) unless url.is_a? URI::Generic
×
UNCOV
14
    build(
×
15
      scheme: url.scheme,
16
      userinfo: url.userinfo,
17
      host: url.host,
18
      port: url.port,
19
      registry: url.registry,
20
      path: url.path,
21
      opaque: url.opaque,
22
      query: url.query,
23
      fragment: url.fragment
24
    )
25
  end
26

27
  # Validates whether or not a URL is an ARK URL
28
  # @param uri [URI::Generic] a URL
29
  # @return [TrueClass, FalseClass]
30
  def self.princeton_ark?(url:)
1✔
UNCOV
31
    return false if url.to_s.start_with?('http:http:')
×
UNCOV
32
    return false unless PRINCETON_ARK_REGEX.match(url.to_s)
×
UNCOV
33
    return false unless ARK_REGEX.match(url.to_s)
×
34

UNCOV
35
    true
×
36
  end
37

38
  # Constructor
39
  def initialize(*arg)
1✔
UNCOV
40
    super(*arg)
×
UNCOV
41
    extract_components!
×
42
  end
43

44
  private
1✔
45

46
    # Extract the components from the ARK URL into member variables
47
    def extract_components!
1✔
UNCOV
48
      raise StandardError, "Invalid ARK URL using: #{self.to_s}" unless self.class.princeton_ark?(url: self)
×
49

UNCOV
50
      m = ARK_REGEX.match(self.to_s)
×
51

UNCOV
52
      @nmah = m[1]
×
UNCOV
53
      @naan = m[2]
×
UNCOV
54
      @name = m[3]
×
55
    end
56
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