Class: Ecfr::SearchService::ContentVersion::Result
- Inherits:
-
Ecfr::SearchService::ContentVersion
- Object
- Client
- Base
- Base
- Ecfr::SearchService::ContentVersion
- Ecfr::SearchService::ContentVersion::Result
- Extended by:
- Constants::ChangeTypes, ResponseHelper
- Defined in:
- lib/ecfr/search_service/content_version/result.rb,
lib/ecfr/testing/extensions/search_service/content_version_result_extensions.rb
Constant Summary collapse
- RESULTS_PATH =
"v1/results"
Constants included from Constants::ChangeTypes
Constants::ChangeTypes::KNOWN_CHANGE_TYPES
Constants inherited from Base
Base::SUPPORTED_ARRAY_ACCESSORS
Instance Attribute Summary collapse
-
#change_types ⇒ [:symbol]
readonly
array of change types that corresponds to the keys in Constants::ChangeTypes::KNOWN_CHANGE_TYPES.
-
#current_page ⇒ Integer
readonly
current page of results.
-
#description ⇒ String
readonly
description of the search results.
-
#ends_on ⇒ Date
readonly
the last date this version of the content appeared in the eCFR.
-
#full_text_excerpt ⇒ String
readonly
excerpt of text where matching keywords were found.
-
#headings ⇒ Ecfr::Common::Hierarchy
readonly
the descriptive portion of the CFR level.
-
#hierarchy ⇒ Ecfr::Common::Hierarchy
readonly
the shortened identifier portion of the CFR level.
-
#hierarchy_headings ⇒ Ecfr::Common::Hierarchy
readonly
the full identifier portion of the CFR level.
-
#max_date ⇒ Date
readonly
the maximum date of all returned results.
-
#max_score ⇒ Float
readonly
the maximum score of any match in the search.
-
#min_date ⇒ Date
readonly
the minimum date of all returned results.
-
#removed ⇒ Boolean
readonly
whether the result represents a part of the CFR that has been removed.
-
#reserved ⇒ Boolean
readonly
whether the result represents a portion of the CFR that is Reserved.
-
#score ⇒ Float
readonly
numerical representation of ranking within results.
-
#starts_on ⇒ Date
readonly
the first date this version of the content appeared in the eCFR.
-
#structure_index ⇒ Integer
readonly
index of where content was found in relation to other content within the title - used for sorting.
-
#total_count ⇒ Integer
readonly
total count of matching results across all pages.
-
#total_pages ⇒ Integer
readonly
total number of pages in the search results.
-
#type ⇒ String
readonly
the content type returned - either Appendix or Section.
Attributes inherited from Base
#metadata, #request_data, #response_status, #results
Class Method Summary collapse
-
.find(args) ⇒ [<Result>]
Retrieve results of search query.
- .response_for(content_versions) ⇒ Object
Methods included from ResponseHelper
Methods inherited from Ecfr::SearchService::ContentVersion
count, hierarchical_search, search, suggestions, summary
Methods inherited from Base
base_url, service_name, service_path
Methods inherited from Base
basic_auth_client_options, #each, #initialize, metadata, metadata_key, result_key
Methods included from Extensible
Methods included from AttributeMethodDefinition
Methods inherited from Client
build, cache_key, client, client_pool, delete, execute, get, handle_response, perform, post, purge
Methods included from ParallelClient
Constructor Details
This class inherits a constructor from Ecfr::Base
Instance Attribute Details
#change_types ⇒ [:symbol] (readonly)
array of change types that corresponds to the keys in Constants::ChangeTypes::KNOWN_CHANGE_TYPES
22 23 24 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 22 attribute :change_types, type: Array(:symbol), desc: "array of change types that corresponds to the keys in {KNOWN_CHANGE_TYPES}" |
#current_page ⇒ Integer (readonly)
current page of results
55 56 57 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 55 :current_page, type: :integer, desc: "current page of results" |
#description ⇒ String (readonly)
description of the search results
52 53 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 52 :description, desc: "description of the search results" |
#ends_on ⇒ Date (readonly)
the last date this version of the content appeared in the eCFR
33 34 35 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 33 attribute :ends_on, type: :date, desc: "the last date this version of the content appeared in the eCFR" |
#full_text_excerpt ⇒ String (readonly)
excerpt of text where matching keywords were found
9 10 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 9 attribute :full_text_excerpt, desc: "excerpt of text where matching keywords were found" |
#headings ⇒ Ecfr::Common::Hierarchy (readonly)
the descriptive portion of the CFR level
40 41 42 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 40 attribute :headings, type: Ecfr::Common::Hierarchy, desc: "the descriptive portion of the CFR level" |
#hierarchy ⇒ Ecfr::Common::Hierarchy (readonly)
the shortened identifier portion of the CFR level
43 44 45 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 43 attribute :hierarchy, type: Ecfr::Common::Hierarchy, desc: "the shortened identifier portion of the CFR level" |
#hierarchy_headings ⇒ Ecfr::Common::Hierarchy (readonly)
the full identifier portion of the CFR level
46 47 48 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 46 attribute :hierarchy_headings, type: Ecfr::Common::Hierarchy, desc: "the full identifier portion of the CFR level" |
#max_date ⇒ Date (readonly)
the maximum date of all returned results
76 77 78 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 76 :max_date, type: :date, desc: "the maximum date of all returned results" |
#max_score ⇒ Float (readonly)
the maximum score of any match in the search
65 66 67 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 65 :max_score, type: :float, desc: "the maximum score of any match in the search" |
#min_date ⇒ Date (readonly)
the minimum date of all returned results
71 72 73 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 71 :min_date, type: :date, desc: "the minimum date of all returned results" |
#removed ⇒ Boolean (readonly)
whether the result represents a part of the CFR that has been removed
29 30 31 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 29 attribute :removed, type: :boolean, desc: "whether the result represents a part of the CFR that has been removed" |
#reserved ⇒ Boolean (readonly)
whether the result represents a portion of the CFR that is Reserved
26 27 28 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 26 attribute :reserved, type: :boolean, desc: "whether the result represents a portion of the CFR that is Reserved" |
#score ⇒ Float (readonly)
numerical representation of ranking within results
14 15 16 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 14 attribute :score, type: :float, desc: "numerical representation of ranking within results" |
#starts_on ⇒ Date (readonly)
the first date this version of the content appeared in the eCFR
36 37 38 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 36 attribute :starts_on, type: :date, desc: "the first date this version of the content appeared in the eCFR" |
#structure_index ⇒ Integer (readonly)
index of where content was found in relation to other content within the title - used for sorting
18 19 20 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 18 attribute :structure_index, type: :integer, desc: "index of where content was found in relation to other content within the title - used for sorting" |
#total_count ⇒ Integer (readonly)
total count of matching results across all pages
58 59 60 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 58 :total_count, type: :integer, desc: "total count of matching results across all pages" |
#total_pages ⇒ Integer (readonly)
total number of pages in the search results
61 62 63 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 61 :total_pages, type: :integer, desc: "total number of pages in the search results" |
#type ⇒ String (readonly)
the content type returned - either Appendix or Section
11 12 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 11 attribute :type, desc: "the content type returned - either *Appendix* or *Section*" |
Class Method Details
.find(args) ⇒ [<Result>]
Retrieve results of search query
101 102 103 104 105 106 107 |
# File 'lib/ecfr/search_service/content_version/result.rb', line 101 def self.find(args) perform( :get, RESULTS_PATH, params: args.compact ) end |
.response_for(content_versions) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ecfr/testing/extensions/search_service/content_version_result_extensions.rb', line 4 def self.response_for(content_versions) content_versions = content_versions.is_a?(Array) ? content_versions : [content_versions] results = { results: content_versions, meta: content_versions.first.fetch("meta", nil) }.compact build( response: stubbed_response(results.to_json) ) end |