Skip to content

Commit

Permalink
facets: Changing the availability toggle by a multiple option
Browse files Browse the repository at this point in the history
  • Loading branch information
psaiz committed Feb 3, 2025
1 parent ca99478 commit be30fc5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
13 changes: 8 additions & 5 deletions cernopendata/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,12 @@ def _query_parser_and(qstr=None):
)
else:
_query = dsl.Q()
if (
request.values.get("ondemand") != "true"
and request.values.get("ondemand") != "ondemand"
):
_query = _query & ~dsl.Q("match", **{"distribution.availability": "ondemand"})

# if (
# request.values.get("ondemand") != "true"
# and request.values.get("ondemand") != "ondemand"
# ):
# _query = _query & ~dsl.Q("match", **{"distribution.availability": "ondemand"})
return _query


Expand Down Expand Up @@ -478,6 +479,7 @@ def _query_parser_and(qstr=None):
),
),
experiment=dict(terms=dict(field="experiment", order=dict(_key="asc"))),
availability=dict(terms=dict(field="availability")),
year=dict(
terms=dict(field="date_created", size=70, order=dict(_key="asc"))
),
Expand Down Expand Up @@ -526,6 +528,7 @@ def _query_parser_and(qstr=None):
keywords=dict(terms=dict(field="keywords", order=dict(_key="asc"))),
),
"post_filters": dict(
availability=terms_filter("availability"),
type=nested_filter("type.primary", "type.secondary"),
experiment=terms_filter("experiment"),
year=terms_filter("date_created"),
Expand Down
11 changes: 11 additions & 0 deletions cernopendata/modules/fixtures/data/terms/terms.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
"primary": "Glossary"
}
},
{
"anchor": "Availability",
"category": "generic",
"definition": "In order to optimize storage costs, some of the datasets are stored on tape. These datasets are not available immediately from the web portal, and they have to be requested in advance. Some datasets offer some sample files, and keep the bulk of the data on tape. The three options for availability are: online (files can be accessed immediately), sample files (some files from the dataset can be accessible immediately), ondemand (the dataset has to be requested before it could be accessed). The instructions on how to request a dataset are explained in the relevant records",
"term": [
"Availability"
],
"type": {
"primary": "Glossary"
}
},
{
"anchor": "Barn",
"category": "generic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ const CODFacets = ({ aggs, updateQueryState, currentQueryState }) => {
<div class="content"><ActiveFilters /></div>
</div>

<Toggle
title="Availability"
label="include on-demand datasets"
filterValue={["ondemand", "ondemand"]}
/>
{aggs.map((agg) => (
<BucketAggregation key={agg.title} title={agg.title} agg={agg.agg} />
))}
Expand Down
1 change: 1 addition & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ services:
- WDB_NO_BROWSER_AUTO_OPEN=True
volumes:
- ./:/code/
- ../opendata.cern.ch:/content/

web-files:
profiles:
Expand Down

0 comments on commit be30fc5

Please sign in to comment.