Module: Sufia::GenericFile::Querying::ClassMethods
- Defined in:
- app/models/concerns/sufia/generic_file/querying.rb
Instance Method Summary collapse
- #date_format ⇒ Object
-
#find_by_date_created(start_datetime, end_datetime = nil) ⇒ Object
query to find generic files created during the time range.
- #where_access_is(access_level) ⇒ Object
- #where_private ⇒ Object
- #where_public ⇒ Object
- #where_registered ⇒ Object
Instance Method Details
#date_format ⇒ Object
37 38 39 |
# File 'app/models/concerns/sufia/generic_file/querying.rb', line 37 def date_format "%Y-%m-%dT%H:%M:%SZ" end |
#find_by_date_created(start_datetime, end_datetime = nil) ⇒ Object
query to find generic files created during the time range
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/concerns/sufia/generic_file/querying.rb', line 10 def find_by_date_created(start_datetime, end_datetime=nil) return [] if start_datetime.blank? # no date just return nothing start_date_str = start_datetime.utc.strftime(self.date_format) end_date_str = if end_datetime.blank? "*" else end_datetime.utc.strftime(self.date_format) end where "system_create_dtsi:[#{start_date_str} TO #{end_date_str}]" end |
#where_access_is(access_level) ⇒ Object
33 34 35 |
# File 'app/models/concerns/sufia/generic_file/querying.rb', line 33 def where_access_is(access_level) where Solrizer.solr_name('read_access_group', :symbol) => access_level end |
#where_private ⇒ Object
21 22 23 |
# File 'app/models/concerns/sufia/generic_file/querying.rb', line 21 def where_private where_access_is 'private' end |
#where_public ⇒ Object
25 26 27 |
# File 'app/models/concerns/sufia/generic_file/querying.rb', line 25 def where_public where_access_is 'public' end |
#where_registered ⇒ Object
29 30 31 |
# File 'app/models/concerns/sufia/generic_file/querying.rb', line 29 def where_registered where_access_is 'registered' end |