Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/update-sockets' into update-sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Jan 15, 2024
2 parents cf37633 + 000c80a commit 4d77bb3
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Internal changes
* The GitHub Workflows now use the `step-security/harden-runner` action to monitor source code, actions, and dependency safety. All workflows now employ more constrained permissions rule sets to prevent security issues. (:pull:`1577`, :pull:`1578`, :pull:`1597`).
* Updated the CONTRIBUTING.rst directions to showcase the new versioning system. (:issue:`1557`, :pull:`1573`).
* The `codespell` library is now a development dependency for the `dev` installation recipe with configurations found within `pyproject.toml`. This is also now a linting step and integrated as a `pre-commit` hook. For more information, see the `codespell documentation <https://github.com/codespell-project/codespell>`_ (:pull:`1576`).
* Climate indicators search page now prioritizes the "official" indicators (atmos, land, seaIce and generic), virtual submodules can be added to search through checkbox option. (:issue:`1559`, :pull:`1593`).


v0.47.0 (2023-12-01)
Expand Down
20 changes: 16 additions & 4 deletions docs/_static/indsearch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Array of indicator objects */
let indicators = [];

let defModules = ["atmos", "generic", "land", "seaIce"];
/* MiniSearch object defining search mechanism */
let miniSearch = new MiniSearch({
fields: ['title', 'abstract', 'variables', 'keywords', 'id'], // fields to index for full-text search
Expand All @@ -9,6 +9,13 @@ let miniSearch = new MiniSearch({
boost: {'title': 3, 'variables': 2},
fuzzy: 0.1,
prefix: true,
boostDocument: (docID, term, storedFields) => {
if (defModules.indexOf(storedFields['module']) > -1) {
return 2;
} else {
return 1;
}
},
},
extractField: (doc, field) => {
if (field === 'variables') {
Expand Down Expand Up @@ -87,11 +94,16 @@ function indTemplate(ind) {

function indFilter() {
const input = document.getElementById("queryInput").value;
const incVirt = document.getElementById("incVirtMod").checked;
let opts = {};
if (!incVirt) {
opts["filter"] = (result) => (defModules.indexOf(result.module) > -1);
}
let inds = [];
if (input === "") {
inds = indicators;
if (input === "") { //Search wildcard so that boostDocument rules are applied.
inds = miniSearch.search(MiniSearch.wildcard, opts);
} else {
inds = miniSearch.search(input);
inds = miniSearch.search(input, opts);
}

const newTable = inds.map(indTemplate).join('');
Expand Down
4 changes: 4 additions & 0 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ code > .indName {
margin: 5px;
background-color: #ddd;
}

#incVirtModLbl {
display: inline;
}
2 changes: 1 addition & 1 deletion docs/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% block scripts %}
{% if "indicators" in sourcename %}
<script src="https://cdn.jsdelivr.net/npm/minisearch@6.1.0/dist/umd/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/minisearch@6.3.0/dist/umd/index.min.js"></script>
<script type="text/javascript" src="./_static/indsearch.js"></script>
{% endif %}
{{ super() }}
Expand Down
2 changes: 1 addition & 1 deletion docs/indicators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ allows a simple free text search of all indicators. Click on the python names to
.. raw:: html

<input type="text" id="queryInput" onkeyup="indFilter()" placeholder="Search for titles, variables or keywords...">

<input type="checkbox" id="incVirtMod" onchange="indFilter()"><label id="incVirtModLbl" for="virtualModules">Include virtual submodules in results.</label>
<div id="indTable">
</div>

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ target-version = [
]

[tool.bumpversion]
current_version = "0.47.5-dev.6"
current_version = "0.47.5-dev.7"
commit = true
commit_args = "--no-verify"
tag = false
Expand Down
2 changes: 1 addition & 1 deletion xclim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

__author__ = """Travis Logan"""
__email__ = "[email protected]"
__version__ = "0.47.5-dev.6"
__version__ = "0.47.5-dev.7"


_module_data = _files("xclim.data")
Expand Down

0 comments on commit 4d77bb3

Please sign in to comment.