Skip to content

Commit

Permalink
Add has audio problems option to beta search options
Browse files Browse the repository at this point in the history
  • Loading branch information
ffont committed Apr 10, 2024
1 parent 95cc52e commit fb66edb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion templates/search/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,13 @@ <h3>
</div>
</div>
<div class="row">
<div class="col-6 v-padding-1">
<div class="col-4 v-padding-1">
<div class="v-spacing-top-1">{% display_search_option "compute_clusters" %}</div>
<div class="v-spacing-top-1">{% display_search_option "similar_to" %}</div>
</div>
<div class="col-4 v-padding-1">
<div class="v-spacing-top-1">{% display_search_option "include_audio_problems" %}</div>
</div>

</div>
{% endif %}
Expand Down
12 changes: 12 additions & 0 deletions utils/search/search_query_processor_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def __copy2__(self):


class SearchOptionBool(SearchOption):
"""SearchOption class to represent bool options.
"""
value_default = False

def get_value_from_request(self):
Expand All @@ -198,6 +200,16 @@ def as_filter(self):
updating this class to support a different behavior."""
if self.value_to_apply == True:
return super().as_filter()


class SearchOptionBoolFilterInverted(SearchOptionBool):
"""SearchOption class to represent bool options which should have the filter value inverted.
For example, an "exclude some sounds" option which, when set to "on", the filter in the search
engine should be inverted, e.g. "sound_has_property:0".
"""

def format_value(self, value):
return '0' if value else '1'


class SearchOptionInt(SearchOption):
Expand Down

0 comments on commit fb66edb

Please sign in to comment.