Class: Queries::CollectingEvent::Filter
- Inherits:
-
Query::Filter
- Object
- Query
- Query::Filter
- Queries::CollectingEvent::Filter
- Includes:
- Queries::Concerns::Attributes, Queries::Concerns::Citations, Queries::Concerns::Confidences, Queries::Concerns::DataAttributes, Queries::Concerns::DateRanges, Queries::Concerns::Depictions, Queries::Concerns::Geo, Queries::Concerns::Notes, Queries::Concerns::Protocols, Queries::Concerns::Tags, Helpers
- Defined in:
- lib/queries/collecting_event/filter.rb
Constant Summary collapse
- ATTRIBUTES =
Params exists for all CollectingEvent attributes except these. geo_shape_id is excluded because we handle it specially in conjunction with ‘geo_mode` Definition must preceed include.
(::CollectingEvent.core_attributes - %w{geo_shape_id geo_shape_type} + %w(cached_level0_geographic_name cached_level1_geographic_name cached_level2_geographic_name)).map(&:to_sym).freeze
- BASE_PARAMS =
This list of params are those that only occur in this CollectingEvent filter. For those that overlap other filters place in PARAMS.
Used to define a base collecting query for CollectionObject filters scope, this is still used in CollectionObject query. This is “necessary” so that we can use CollectingEvent referencing facets in the CollectionObject filter for convienience.
[ *Queries::Concerns::Attributes.params, *ATTRIBUTES, :collectors, :collecting_event_object_id, :collection_objects, :collector_id, :collector_id_or, :collecting_event_id, :determiner_name_regex, :geo_json, :geographic_area, :geo_mode, :geo_shape_id, :geo_shape_type, :georeferences, :in_labels, :md5_verbatim_label, :radius, :use_max, :use_min, :wkt, collecting_event_id: [], collector_id: [], geo_shape_id: [], geo_shape_type: [] ].inject([{}]){|ary, k| k.is_a?(Hash) ? ary.last.merge!(k) : ary.unshift(k); ary}.freeze
- PARAMS =
[ *BASE_PARAMS, :otu_id, :collection_object_id, collection_object_id: [], otu_id: [], ].inject([{}]){|ary, k| k.is_a?(Hash) ? ary.last.merge!(k) : ary.unshift(k); ary}.freeze
Constants inherited from Query::Filter
Query::Filter::FILTER_QUERIES, Query::Filter::SUBQUERIES
Instance Attribute Summary collapse
- #collecting_event_id ⇒ Object
-
#collection_object_id ⇒ Object
Array.
- #collection_objects ⇒ Object
-
#collector_id ⇒ Array
DONE: singularize and handle array or single.
- #collector_id_or ⇒ Boolean
-
#collectors ⇒ Boolean?
True - A collector role exists false - A collector role exists nil - not applied.
-
#geo_json ⇒ Hash?
In geo_json format (no Feature …) ?!.
-
#geographic_area ⇒ True, ...
True - has geographic_area present false - without geographic_area nil - not applied.
-
#georeferences ⇒ True, ...
True - georeferences false - not georeferenced nil - not applied.
-
#in_labels ⇒ Object
Wildcard wrapped matching any label.
-
#md5_verbatim_label ⇒ Object
If true then in_labels checks only the MD5.
-
#otu_id ⇒ Array
DONE: singularize and handle array or single.
-
#radius ⇒ Object
Integer in Meters !! defaults to 100m.
-
#use_max ⇒ String?
The maximum number of CollectionObjects linked to CollectingEvent must be > use_min, defaults to use_min if blank and use_min.
-
#use_min ⇒ String?
The minimum number of CollectionObjects linked to CollectingEvent.
-
#wkt ⇒ Object
A spatial representation in well known text.
Attributes inherited from Query::Filter
#api, #asserted_distribution_query, #biological_association_query, #biological_associations_graph_query, #collecting_event_query, #collection_object_query, #content_query, #controlled_vocabulary_term_query, #data_attribute_query, #depiction_query, #descriptor_query, #document_query, #dwc_occurrence_query, #extract_query, #field_occurrence_query, #image_query, #loan_query, #object_global_id, #observation_query, #order_by, #otu_query, #page, #paginate, #params, #per, #person_query, #project_id, #recent, #recent_target, #sound_query, #taxon_name_query, #venn, #venn_mode
Attributes inherited from Query
Class Method Summary collapse
Instance Method Summary collapse
- #and_clauses ⇒ Array
- #any_label_facet ⇒ Object
- #biological_association_query_facet ⇒ Object
- #collecting_event_geo_facet ⇒ Object
- #collecting_event_geo_facet_by_type(shape_string, shape_ids) ⇒ Object
- #collecting_event_id_facet ⇒ Object
- #collection_object_query_facet ⇒ Object
-
#collection_objects_facet ⇒ Object
Scope.
-
#collector_id_facet ⇒ Object
TODO: dry with Source, TaxonName, etc.
- #collectors_facet ⇒ Object
- #dwc_occurrence_query_facet ⇒ Object
- #field_occurrence_query_facet ⇒ Object
-
#from_wkt(wkt_shape) ⇒ Object
TODO: check, this should be simplifiable.
-
#geo_json_facet ⇒ Object
Shape is a Hash in GeoJSON format.
- #geographic_area_facet ⇒ Object
- #georeferences_facet ⇒ Object
- #housekeeping_extensions ⇒ Object
-
#initialize(query_params) ⇒ Filter
constructor
A new instance of Filter.
- #matching_collection_object_id ⇒ Object
- #merge_clauses ⇒ Object
- #otu_id_facet ⇒ Object
- #otu_query_facet ⇒ Object
-
#spatial_query(geometry_type, wkt) ⇒ Object
TODO: Spatial concern?.
- #taxon_name_query_facet ⇒ Object
- #use_facet ⇒ Object
- #verbatim_label_md5_facet ⇒ Object
- #wkt_facet ⇒ Object
Methods included from Helpers
#boolean_param, #integer_param
Methods inherited from Query::Filter
#all, #all_and_clauses, #all_merge_clauses, #annotator_and_clauses, #annotator_merge_clauses, annotator_params, api_except_params, api_excluded_params, #apply_venn, #attribute_exact_facet, base_filter, base_query_name, base_query_to_h, #deep_permit, included_annotator_facets, instantiated_base_filter, inverted_subqueries, #model_id_facet, #object_global_id_facet, #only_project?, params, #permitted_params, #process_url_into_params, #project_id_facet, query_name, #query_name, #set_nested_queries, #shared_and_clauses, #subquery_vector, #target_and_clauses, #venn_query
Methods inherited from Query
#alphabetic_strings, #alphanumeric_strings, base_name, #base_name, #base_query, #build_terms, #cached_facet, #end_wildcard, #levenshtein_distance, #match_ordered_wildcard_pieces_in_cached, #no_terms?, referenced_klass, #referenced_klass, #referenced_klass_except, #referenced_klass_intersection, #referenced_klass_union, #start_and_end_wildcard, #start_wildcard, #table, #wildcard_pieces
Constructor Details
#initialize(query_params) ⇒ Filter
Returns a new instance of Filter.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/queries/collecting_event/filter.rb', line 150 def initialize(query_params) super @collectors = boolean_param(params, :collectors ) @collecting_event_id = params[:collecting_event_id] @collection_object_id = params[:collection_object_id] @collection_objects = boolean_param(params, :collection_objects ) @collector_id = params[:collector_id] @collector_id_or = boolean_param(params, :collector_id_or ) @geo_json = params[:geo_json] @geographic_area = boolean_param(params, :geographic_area) @georeferences = boolean_param(params, :georeferences) @in_labels = params[:in_labels] @md5_verbatim_label = params[:md5_verbatim_label]&.to_s&.downcase == 'true' @otu_id = params[:otu_id].presence @radius = params[:radius].presence || 100.0 @use_max = params[:use_max] @use_min = params[:use_min] @wkt = params[:wkt] set_confidences_params(params) set_attributes_params(params) set_citations_params(params) set_data_attributes_params(params) set_date_params(params) set_depiction_params(params) set_geo_params(params) set_notes_params(params) set_protocols_params(params) (params) end |
Instance Attribute Details
#collecting_event_id ⇒ Object
82 83 84 |
# File 'lib/queries/collecting_event/filter.rb', line 82 def collecting_event_id @collecting_event_id end |
#collection_object_id ⇒ Object
Returns Array.
127 128 129 |
# File 'lib/queries/collecting_event/filter.rb', line 127 def collection_object_id @collection_object_id end |
#collection_objects ⇒ Object
122 123 124 |
# File 'lib/queries/collecting_event/filter.rb', line 122 def collection_objects @collection_objects end |
#collector_id ⇒ Array
DONE: singularize and handle array or single
107 108 109 |
# File 'lib/queries/collecting_event/filter.rb', line 107 def collector_id @collector_id end |
#collector_id_or ⇒ Boolean
113 114 115 |
# File 'lib/queries/collecting_event/filter.rb', line 113 def collector_id_or @collector_id_or end |
#collectors ⇒ Boolean?
Returns true - A collector role exists false - A collector role exists nil - not applied.
78 79 80 |
# File 'lib/queries/collecting_event/filter.rb', line 78 def collectors @collectors end |
#geo_json ⇒ Hash?
Returns in geo_json format (no Feature …) ?!.
99 100 101 |
# File 'lib/queries/collecting_event/filter.rb', line 99 def geo_json @geo_json end |
#geographic_area ⇒ True, ...
Returns true - has geographic_area present false - without geographic_area nil - not applied.
139 140 141 |
# File 'lib/queries/collecting_event/filter.rb', line 139 def geographic_area @geographic_area end |
#georeferences ⇒ True, ...
Returns true - georeferences false - not georeferenced nil - not applied.
133 134 135 |
# File 'lib/queries/collecting_event/filter.rb', line 133 def georeferences @georeferences end |
#in_labels ⇒ Object
Wildcard wrapped matching any label
85 86 87 |
# File 'lib/queries/collecting_event/filter.rb', line 85 def in_labels @in_labels end |
#md5_verbatim_label ⇒ Object
If true then in_labels checks only the MD5
88 89 90 |
# File 'lib/queries/collecting_event/filter.rb', line 88 def md5_verbatim_label @md5_verbatim_label end |
#otu_id ⇒ Array
DONE: singularize and handle array or single
103 104 105 |
# File 'lib/queries/collecting_event/filter.rb', line 103 def otu_id @otu_id end |
#radius ⇒ Object
Integer in Meters
!! defaults to 100m
95 96 97 |
# File 'lib/queries/collecting_event/filter.rb', line 95 def radius @radius end |
#use_max ⇒ String?
Returns the maximum number of CollectionObjects linked to CollectingEvent must be > use_min, defaults to use_min if blank and use_min.
144 145 146 |
# File 'lib/queries/collecting_event/filter.rb', line 144 def use_max @use_max end |
#use_min ⇒ String?
Returns the minimum number of CollectionObjects linked to CollectingEvent.
148 149 150 |
# File 'lib/queries/collecting_event/filter.rb', line 148 def use_min @use_min end |
#wkt ⇒ Object
A spatial representation in well known text
91 92 93 |
# File 'lib/queries/collecting_event/filter.rb', line 91 def wkt @wkt end |
Class Method Details
.base_params ⇒ Object
68 69 70 71 72 |
# File 'lib/queries/collecting_event/filter.rb', line 68 def self.base_params a = BASE_PARAMS.dup b = a.pop.keys (a + b).uniq end |
Instance Method Details
#and_clauses ⇒ Array
489 490 491 492 493 494 495 496 |
# File 'lib/queries/collecting_event/filter.rb', line 489 def and_clauses [ between_date_range_facet, any_label_facet, collecting_event_id_facet, verbatim_label_md5_facet, ] end |
#any_label_facet ⇒ Object
366 367 368 369 370 |
# File 'lib/queries/collecting_event/filter.rb', line 366 def any_label_facet return nil if in_labels.blank? t = "%#{in_labels}%" table[:verbatim_label].matches(t).or(table[:print_label].matches(t)).or(table[:document_label].matches(t)) end |
#biological_association_query_facet ⇒ Object
405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/queries/collecting_event/filter.rb', line 405 def biological_association_query_facet return nil if biological_association_query.nil? s = 'WITH query_ba_ces AS (' + biological_association_query.all.to_sql + ') ' + ::CollectingEvent.joins(:collection_objects) .joins("LEFT JOIN query_ba_ces as query_ba_ces1 on collection_objects.id = query_ba_ces1.biological_association_subject_id AND query_ba_ces1.biological_association_subject_type = 'CollectionObject'") .joins("LEFT JOIN query_ba_ces as query_ba_ces2 on collection_objects.id = query_ba_ces2.biological_association_object_id AND query_ba_ces2.biological_association_object_type = 'CollectionObject'") .where('(query_ba_ces1.id) IS NOT NULL OR (query_ba_ces2.id IS NOT NULL)') .to_sql ::CollectingEvent.from('(' + s + ') as collecting_events').distinct end |
#collecting_event_geo_facet ⇒ Object
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/queries/collecting_event/filter.rb', line 238 def collecting_event_geo_facet return nil if geo_shape_id.empty? || geo_shape_type.empty? || # TODO: this should raise an error(?) geo_shape_id.length != geo_shape_type.length geographic_area_shapes, gazetteer_shapes = shapes_for_geo_mode a = collecting_event_geo_facet_by_type( 'GeographicArea', geographic_area_shapes ) b = collecting_event_geo_facet_by_type( 'Gazetteer', gazetteer_shapes ) if geo_mode == true # spatial i = ::Queries.union(::GeographicItem, [a,b]) wkt_shape = ::Queries::GeographicItem.st_union(i) .to_a.first['st_union'].to_s return from_wkt(wkt_shape) end referenced_klass_union([a,b]) end |
#collecting_event_geo_facet_by_type(shape_string, shape_ids) ⇒ Object
265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/queries/collecting_event/filter.rb', line 265 def collecting_event_geo_facet_by_type(shape_string, shape_ids) b = nil case geo_mode when nil, false # exact, descendants return nil if shape_string == 'Gazetteer' b = ::CollectingEvent.where(geographic_area: shape_ids) when true # spatial m = shape_string.tableize b = ::GeographicItem.joins(m.to_sym).where(m => shape_ids) end b end |
#collecting_event_id_facet ⇒ Object
379 380 381 382 |
# File 'lib/queries/collecting_event/filter.rb', line 379 def collecting_event_id_facet return nil if collecting_event_id.empty? table[:id].in(collecting_event_id) end |
#collection_object_query_facet ⇒ Object
433 434 435 436 437 438 439 440 441 442 |
# File 'lib/queries/collecting_event/filter.rb', line 433 def collection_object_query_facet return nil if collection_object_query.nil? s = 'WITH query_co_ce AS (' + collection_object_query.all.to_sql + ') ' + ::CollectingEvent .joins(:collection_objects) .joins('JOIN query_co_ce as query_co_ce1 on collection_objects.id = query_co_ce1.id') .to_sql ::CollectingEvent.from('(' + s + ') as collecting_events').distinct end |
#collection_objects_facet ⇒ Object
Returns Scope.
293 294 295 296 297 |
# File 'lib/queries/collecting_event/filter.rb', line 293 def collection_objects_facet return nil if collection_objects.nil? subquery = ::CollectionObject.where(::CollectionObject.arel_table[:collecting_event_id].eq(::CollectingEvent.arel_table[:id])).arel.exists ::CollectingEvent.where(collection_objects ? subquery : subquery.not) end |
#collector_id_facet ⇒ Object
TODO: dry with Source, TaxonName, etc.
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/queries/collecting_event/filter.rb', line 300 def collector_id_facet return nil if collector_id.empty? o = table r = ::Role.arel_table a = o.alias('a_') b = o.project(a[Arel.star]).from(a) c = r.alias('r1') b = b.join(c, Arel::Nodes::OuterJoin) .on( a[:id].eq(c[:role_object_id]) .and(c[:role_object_type].eq('CollectingEvent')) .and(c[:type].eq('Collector')) ) e = c[:id].not_eq(nil) f = c[:person_id].in(collector_id) b = b.where(e.and(f)) b = b.group(a['id']) b = b.having(a['id'].count.eq(collector_id.length)) unless collector_id_or b = b.as('col_z_') ::CollectingEvent.joins(Arel::Nodes::InnerJoin.new(b, Arel::Nodes::On.new(b['id'].eq(o['id'])))) end |
#collectors_facet ⇒ Object
396 397 398 399 400 401 402 403 |
# File 'lib/queries/collecting_event/filter.rb', line 396 def collectors_facet return nil if collectors.nil? if collectors ::CollectingEvent.joins(:collectors).distinct else ::CollectingEvent.where.missing(:collectors) end end |
#dwc_occurrence_query_facet ⇒ Object
455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/queries/collecting_event/filter.rb', line 455 def dwc_occurrence_query_facet return nil if dwc_occurrence_query.nil? s = ::CollectingEvent .with(query_dwc_ce: dwc_occurrence_query.all.select(:dwc_occurrence_object_id, :dwc_occurrence_object_type, :id)) .joins('JOIN collection_objects co on co.collecting_event_id = collecting_events.id') .joins("JOIN dwc_occurrences dwo on dwo.dwc_occurrence_object_type = 'CollectionObject' and dwo.dwc_occurrence_object_id = co.id") .joins('JOIN query_dwc_ce as query_dwc_ce1 on query_dwc_ce1.id = dwo.id') .to_sql ::CollectingEvent.from('(' + s + ') as collecting_events').distinct end |
#field_occurrence_query_facet ⇒ Object
444 445 446 447 448 449 450 451 452 453 |
# File 'lib/queries/collecting_event/filter.rb', line 444 def field_occurrence_query_facet return nil if field_occurrence_query.nil? s = 'WITH query_fo_ce AS (' + field_occurrence_query.all.to_sql + ') ' + ::CollectingEvent .joins(:field_occurrences) .joins('JOIN query_fo_ce as query_fo_ce1 on field_occurrences.id = query_fo_ce1.id') .to_sql ::CollectingEvent.from('(' + s + ') as collecting_events').distinct end |
#from_wkt(wkt_shape) ⇒ Object
TODO: check, this should be simplifiable.
334 335 336 337 338 |
# File 'lib/queries/collecting_event/filter.rb', line 334 def from_wkt(wkt_shape) a = RGeo::WKRep::WKTParser.new(Gis::FACTORY, support_wkt12: true) b = a.parse(wkt_shape) spatial_query(b.geometry_type.to_s, wkt_shape) end |
#geo_json_facet ⇒ Object
Shape is a Hash in GeoJSON format
341 342 343 344 345 346 347 348 |
# File 'lib/queries/collecting_event/filter.rb', line 341 def geo_json_facet return nil if geo_json.nil? if a = RGeo::GeoJSON.decode(geo_json) return spatial_query(a.geometry_type.to_s, a.to_s) else return nil end end |
#geographic_area_facet ⇒ Object
229 230 231 232 233 234 235 236 |
# File 'lib/queries/collecting_event/filter.rb', line 229 def geographic_area_facet return nil if geographic_area.nil? if geographic_area ::CollectingEvent.where.not(geographic_area_id: nil).distinct else ::CollectingEvent.where(geographic_area_id: nil).distinct end end |
#georeferences_facet ⇒ Object
280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/queries/collecting_event/filter.rb', line 280 def georeferences_facet return nil if georeferences.nil? if georeferences ::CollectingEvent.joins(:georeferences).distinct else ::CollectingEvent.left_outer_joins(:georeferences) .where(georeferences: {id: nil}) .distinct end end |
#housekeeping_extensions ⇒ Object
479 480 481 482 483 484 485 486 |
# File 'lib/queries/collecting_event/filter.rb', line 479 def housekeeping_extensions [ housekeeping_extension_query(target: ::DataAttribute, joins: [:data_attributes]), housekeeping_extension_query(target: ::Georeference, joins: [:georeferences]), housekeeping_extension_query(target: ::Note, joins: [:notes]), housekeeping_extension_query(target: ::Role, joins: [:roles]), ] end |
#matching_collection_object_id ⇒ Object
391 392 393 394 |
# File 'lib/queries/collecting_event/filter.rb', line 391 def matching_collection_object_id return nil if collection_object_id.empty? ::CollectingEvent.joins(:collection_objects).where(collection_objects: {id: collection_object_id}).distinct end |
#merge_clauses ⇒ Object
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/queries/collecting_event/filter.rb', line 498 def merge_clauses [ biological_association_query_facet, collection_object_query_facet, field_occurrence_query_facet, dwc_occurrence_query_facet, otu_query_facet, taxon_name_query_facet, collecting_event_geo_facet, collectors_facet, collection_objects_facet, collector_id_facet, geo_json_facet, geographic_area_facet, georeferences_facet, matching_collection_object_id, otu_id_facet, use_facet, wkt_facet, ] end |
#otu_id_facet ⇒ Object
384 385 386 387 388 389 |
# File 'lib/queries/collecting_event/filter.rb', line 384 def otu_id_facet return nil if otu_id.empty? a = ::CollectingEvent.joins(:collection_object_otus).where(otus: {id: otu_id}) b = ::CollectingEvent.joins(:field_occurrence_otus).where(otus: {id: otu_id}) ::Queries.union(::CollectingEvent, [a,b]).distinct end |
#otu_query_facet ⇒ Object
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/queries/collecting_event/filter.rb', line 417 def otu_query_facet return nil if otu_query.nil? a = ::CollectingEvent.with(otu_scope: otu_query.all) .joins(collection_objects: [:taxon_determinations]) .joins('JOIN otu_scope on otu_scope.id = taxon_determinations.otu_id') .where(taxon_determinations: {position: 1}) b = ::CollectingEvent.with(otu_scope: otu_query.all) .joins(field_occurrences: [:taxon_determinations]) .joins('JOIN otu_scope on otu_scope.id = taxon_determinations.otu_id') .where(taxon_determinations: {position: 1}) ::Queries.union(::CollectingEvent, [a,b]) end |
#spatial_query(geometry_type, wkt) ⇒ Object
TODO: Spatial concern?
351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/queries/collecting_event/filter.rb', line 351 def spatial_query(geometry_type, wkt) case geometry_type when 'Point' ::CollectingEvent .joins(:geographic_items) .where(::GeographicItem.within_radius_of_wkt_sql(wkt, radius)) when 'Polygon', 'MultiPolygon' ::CollectingEvent .joins(:geographic_items) .where(::GeographicItem.covered_by_wkt_sql(wkt)) else nil end end |
#taxon_name_query_facet ⇒ Object
468 469 470 471 472 473 474 475 476 477 |
# File 'lib/queries/collecting_event/filter.rb', line 468 def taxon_name_query_facet return nil if taxon_name_query.nil? s = 'WITH query_tn_ce AS (' + taxon_name_query.all.to_sql + ') ' + ::CollectingEvent .joins(collection_objects: [:otus]) .joins('JOIN query_tn_ce as query_tn_ce1 on otus.taxon_name_id = query_tn_ce1.id') .to_sql ::CollectingEvent.from('(' + s + ') as collecting_events').distinct end |
#use_facet ⇒ Object
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/queries/collecting_event/filter.rb', line 208 def use_facet return nil if (use_min.blank? && use_max.blank?) return ::CollectingEvent.none if use_min > use_max q = ::CollectingEvent.left_joins(:collection_objects, :field_occurrences) .group(collecting_events: [:id]) if use_min == use_max if use_min == 0 q = ::CollectingEvent.where.missing(:collection_objects, :field_occurrences) else q = q.having('COUNT(collection_objects.id) + COUNT(field_occurrences.id) = ? ', use_min) end else q = q.having('COUNT(collection_objects.id) + COUNT(field_occurrences.id) BETWEEN ? AND ?', use_min, use_max) end q = q.select(collecting_events: [:id]) ::CollectingEvent.from('(' + q.to_sql + ') as collecting_events').distinct end |
#verbatim_label_md5_facet ⇒ Object
372 373 374 375 376 377 |
# File 'lib/queries/collecting_event/filter.rb', line 372 def verbatim_label_md5_facet return nil unless md5_verbatim_label && in_labels.present? md5 = ::Utilities::Strings.generate_md5(in_labels) table[:md5_of_verbatim_label].eq(md5) end |
#wkt_facet ⇒ Object
328 329 330 331 |
# File 'lib/queries/collecting_event/filter.rb', line 328 def wkt_facet return nil if wkt.blank? from_wkt(wkt) end |