@@ -15,8 +15,7 @@ def document_type
15
15
def filters
16
16
[
17
17
type_filter ,
18
- canonical_filter ,
19
- canonical_or_synonymous_filter ,
18
+ wrangling_status_filter ,
20
19
unwrangleable_filter ,
21
20
posted_works_filter ,
22
21
media_filter ,
@@ -32,6 +31,7 @@ def filters
32
31
def exclusion_filters
33
32
[
34
33
wrangled_filter
34
+ # wrangling_status_exclude_filter
35
35
] . compact
36
36
end
37
37
@@ -78,12 +78,19 @@ def type_filter
78
78
{ term : { tag_type : options [ :type ] } } if options [ :type ]
79
79
end
80
80
81
- def canonical_filter
82
- term_filter ( :canonical , bool_value ( options [ :canonical ] ) ) if options [ :canonical ] . present?
83
- end
84
-
85
- def canonical_or_synonymous_filter
86
- term_filter ( :canonical_or_synonymous , bool_value ( options [ :canonical_or_synonymous ] ) ) if options [ :canonical_or_synonymous ] . present?
81
+ def wrangling_status_filter
82
+ case options [ :wrangling_status ]
83
+ when "canonical"
84
+ return term_filter ( :canonical , true )
85
+ when "noncanonical"
86
+ return term_filter ( :canonical , false )
87
+ when "synonymous"
88
+ return [ { exists : { field : "merger_id" } } , term_filter ( :canonical , false ) ]
89
+ when "canonical_synonymous"
90
+ return { bool : { should : [ { exists : { field : "merger_id" } } , term_filter ( :canonical , true ) ] } }
91
+ when "noncanonical_nonsynonymous"
92
+ return [ { bool : { must_not : { exists : { field : "merger_id" } } } } , term_filter ( :canonical , false ) ]
93
+ end
87
94
end
88
95
89
96
def unwrangleable_filter
0 commit comments