diff --git a/.buildinfo b/.buildinfo
index 90c174952..5c146ee36 100644
--- a/.buildinfo
+++ b/.buildinfo
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 4684e9491dfaabdf6499532dce6b96f6
+config: da87502f4bec4ed891bdd1e665b8301a
tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip b/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip
index 865cd80d2..d2d6af79b 100644
Binary files a/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip and b/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip differ
diff --git a/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip b/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip
index 052a2275e..9ae28bd43 100644
Binary files a/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip and b/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip differ
diff --git a/_images/sphx_glr_simple_arctan_fit_001.png b/_images/sphx_glr_simple_arctan_fit_001.png
index 0466b8116..5704ebb61 100644
Binary files a/_images/sphx_glr_simple_arctan_fit_001.png and b/_images/sphx_glr_simple_arctan_fit_001.png differ
diff --git a/_images/sphx_glr_simple_arctan_fit_thumb.png b/_images/sphx_glr_simple_arctan_fit_thumb.png
index 8d5886926..ebc6b634a 100644
Binary files a/_images/sphx_glr_simple_arctan_fit_thumb.png and b/_images/sphx_glr_simple_arctan_fit_thumb.png differ
diff --git a/_sources/auto_examples/index.rst.txt b/_sources/auto_examples/index.rst.txt
index e90cb8158..2f7ccf74b 100644
--- a/_sources/auto_examples/index.rst.txt
+++ b/_sources/auto_examples/index.rst.txt
@@ -13,6 +13,9 @@ Below is a gallery of examples.
+.. thumbnail-parent-div-open
+
+.. thumbnail-parent-div-close
.. raw:: html
@@ -29,6 +32,7 @@ Below is a gallery of examples on model fitting.
+.. thumbnail-parent-div-open
.. raw:: html
@@ -81,6 +85,8 @@ Below is a gallery of examples on model fitting.
+.. thumbnail-parent-div-close
+
.. raw:: html
diff --git a/_sources/auto_examples/model_fitting/EELS_curve_fitting.rst.txt b/_sources/auto_examples/model_fitting/EELS_curve_fitting.rst.txt
index df68af256..117c107b8 100644
--- a/_sources/auto_examples/model_fitting/EELS_curve_fitting.rst.txt
+++ b/_sources/auto_examples/model_fitting/EELS_curve_fitting.rst.txt
@@ -11,7 +11,7 @@
:class: sphx-glr-download-link-note
:ref:`Go to the end `
- to download the full example code
+ to download the full example code.
.. rst-class:: sphx-glr-example-title
@@ -38,7 +38,7 @@ png file.
.. code-block:: none
-
0%| | 0.00/42.3M [00:00, ?B/s]
0%| | 14.3k/42.3M [00:00<05:35, 126kB/s]
0%| | 41.0k/42.3M [00:00<03:37, 194kB/s]
0%| | 120k/42.3M [00:00<01:38, 428kB/s]
1%|▎ | 271k/42.3M [00:00<00:52, 794kB/s]
1%|▌ | 559k/42.3M [00:00<00:29, 1.43MB/s]
3%|█ | 1.15M/42.3M [00:00<00:15, 2.74MB/s]
5%|██ | 2.31M/42.3M [00:00<00:07, 5.23MB/s]
11%|████ | 4.65M/42.3M [00:00<00:03, 10.2MB/s]
18%|██████▋ | 7.60M/42.3M [00:01<00:02, 15.3MB/s]
24%|████████▋ | 9.94M/42.3M [00:01<00:01, 17.6MB/s]
28%|██████████▎ | 11.7M/42.3M [00:01<00:01, 17.6MB/s]
33%|████████████▎ | 14.0M/42.3M [00:01<00:01, 18.5MB/s]
40%|██████████████▋ | 16.7M/42.3M [00:01<00:01, 20.1MB/s]
46%|█████████████████ | 19.5M/42.3M [00:01<00:01, 21.5MB/s]
52%|███████████████████▎ | 22.0M/42.3M [00:01<00:00, 21.7MB/s]
58%|█████████████████████▍ | 24.5M/42.3M [00:01<00:00, 21.8MB/s]
64%|███████████████████████▊ | 27.1M/42.3M [00:01<00:00, 22.4MB/s]
70%|██████████████████████████ | 29.7M/42.3M [00:01<00:00, 22.6MB/s]
76%|████████████████████████████▎ | 32.3M/42.3M [00:02<00:00, 22.7MB/s]
83%|██████████████████████████████▌ | 34.9M/42.3M [00:02<00:00, 23.0MB/s]
89%|████████████████████████████████▉ | 37.6M/42.3M [00:02<00:00, 23.1MB/s]
96%|███████████████████████████████████▍ | 40.4M/42.3M [00:02<00:00, 23.8MB/s]
0%| | 0.00/42.3M [00:00, ?B/s]
100%|██████████████████████████████████████| 42.3M/42.3M [00:00<00:00, 278GB/s]
+
0%| | 0.00/42.3M [00:00, ?B/s]
0%| | 14.3k/42.3M [00:00<08:01, 87.7kB/s]
0%| | 54.3k/42.3M [00:00<03:54, 180kB/s]
0%| | 134k/42.3M [00:00<02:10, 323kB/s]
1%|▎ | 290k/42.3M [00:00<01:13, 574kB/s]
1%|▌ | 606k/42.3M [00:00<00:38, 1.07MB/s]
3%|█ | 1.24M/42.3M [00:00<00:20, 2.05MB/s]
6%|██▏ | 2.52M/42.3M [00:01<00:10, 3.95MB/s]
12%|████▍ | 5.09M/42.3M [00:01<00:04, 7.74MB/s]
18%|██████▊ | 7.80M/42.3M [00:01<00:03, 10.6MB/s]
25%|█████████▎ | 10.7M/42.3M [00:01<00:02, 12.9MB/s]
32%|███████████▋ | 13.4M/42.3M [00:01<00:02, 13.9MB/s]
38%|██████████████ | 16.0M/42.3M [00:01<00:01, 14.6MB/s]
44%|████████████████▎ | 18.7M/42.3M [00:02<00:01, 15.2MB/s]
51%|██████████████████▊ | 21.5M/42.3M [00:02<00:01, 15.8MB/s]
57%|█████████████████████▏ | 24.2M/42.3M [00:02<00:01, 16.1MB/s]
64%|███████████████████████▌ | 26.9M/42.3M [00:02<00:00, 16.3MB/s]
70%|█████████████████████████▉ | 29.7M/42.3M [00:02<00:00, 16.5MB/s]
77%|████████████████████████████▎ | 32.4M/42.3M [00:02<00:00, 16.7MB/s]
83%|██████████████████████████████▋ | 35.0M/42.3M [00:03<00:00, 16.5MB/s]
89%|█████████████████████████████████ | 37.7M/42.3M [00:03<00:00, 16.6MB/s]
96%|███████████████████████████████████▍ | 40.5M/42.3M [00:03<00:00, 16.7MB/s]
0%| | 0.00/42.3M [00:00, ?B/s]
100%|██████████████████████████████████████| 42.3M/42.3M [00:00<00:00, 260GB/s]
@@ -68,7 +68,7 @@ png file.
.. rst-class:: sphx-glr-timing
- **Total running time of the script:** (0 minutes 7.511 seconds)
+ **Total running time of the script:** (0 minutes 9.313 seconds)
.. _sphx_glr_download_auto_examples_model_fitting_EELS_curve_fitting.py:
diff --git a/_sources/auto_examples/model_fitting/index.rst.txt b/_sources/auto_examples/model_fitting/index.rst.txt
index 6acdaae4c..98f418b4d 100644
--- a/_sources/auto_examples/model_fitting/index.rst.txt
+++ b/_sources/auto_examples/model_fitting/index.rst.txt
@@ -13,6 +13,7 @@ Below is a gallery of examples on model fitting.
+.. thumbnail-parent-div-open
.. raw:: html
@@ -65,6 +66,8 @@ Below is a gallery of examples on model fitting.
+.. thumbnail-parent-div-close
+
.. raw:: html
diff --git a/_sources/auto_examples/model_fitting/plot_residual.rst.txt b/_sources/auto_examples/model_fitting/plot_residual.rst.txt
index b8a5cd3a3..02f9f6fe4 100644
--- a/_sources/auto_examples/model_fitting/plot_residual.rst.txt
+++ b/_sources/auto_examples/model_fitting/plot_residual.rst.txt
@@ -11,7 +11,7 @@
:class: sphx-glr-download-link-note
:ref:`Go to the end `
- to download the full example code
+ to download the full example code.
.. rst-class:: sphx-glr-example-title
@@ -110,7 +110,7 @@ Fit for all navigation positions:
.. code-block:: none
- Exception ignored in:
+ Exception ignored in:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/tqdm/std.py", line 1148, in __del__
self.close()
@@ -118,7 +118,7 @@ Fit for all navigation positions:
self.disp(bar_style='danger', check_delay=False)
^^^^^^^^^
AttributeError: 'tqdm_notebook' object has no attribute 'disp'
-
0%| | 0/10 [00:00, ?it/s]
100%|██████████| 10/10 [00:00<00:00, 1492.26it/s]
+
0%| | 0/10 [00:00, ?it/s]
100%|██████████| 10/10 [00:00<00:00, 1465.67it/s]
@@ -164,7 +164,7 @@ sphinx_gallery_thumbnail_number = 2
.. rst-class:: sphx-glr-timing
- **Total running time of the script:** (0 minutes 0.562 seconds)
+ **Total running time of the script:** (0 minutes 0.599 seconds)
.. _sphx_glr_download_auto_examples_model_fitting_plot_residual.py:
diff --git a/_sources/auto_examples/model_fitting/sg_execution_times.rst.txt b/_sources/auto_examples/model_fitting/sg_execution_times.rst.txt
index 2e78fc41a..2dd6cf749 100644
--- a/_sources/auto_examples/model_fitting/sg_execution_times.rst.txt
+++ b/_sources/auto_examples/model_fitting/sg_execution_times.rst.txt
@@ -6,7 +6,7 @@
Computation times
=================
-**00:08.435** total execution time for 3 files **from auto_examples/model_fitting**:
+**00:10.273** total execution time for 3 files **from auto_examples/model_fitting**:
.. container::
@@ -33,11 +33,11 @@ Computation times
- Time
- Mem (MB)
* - :ref:`sphx_glr_auto_examples_model_fitting_EELS_curve_fitting.py` (``EELS_curve_fitting.py``)
- - 00:07.511
+ - 00:09.313
- 0.0
* - :ref:`sphx_glr_auto_examples_model_fitting_plot_residual.py` (``plot_residual.py``)
- - 00:00.562
+ - 00:00.599
- 0.0
* - :ref:`sphx_glr_auto_examples_model_fitting_simple_arctan_fit.py` (``simple_arctan_fit.py``)
- - 00:00.362
+ - 00:00.361
- 0.0
diff --git a/_sources/auto_examples/model_fitting/simple_arctan_fit.rst.txt b/_sources/auto_examples/model_fitting/simple_arctan_fit.rst.txt
index 1590a66b9..b605fc45e 100644
--- a/_sources/auto_examples/model_fitting/simple_arctan_fit.rst.txt
+++ b/_sources/auto_examples/model_fitting/simple_arctan_fit.rst.txt
@@ -11,7 +11,7 @@
:class: sphx-glr-download-link-note
:ref:`Go to the end `
- to download the full example code
+ to download the full example code.
.. rst-class:: sphx-glr-example-title
@@ -42,9 +42,9 @@ Fit an arctan function.
Active: True
Parameter Name | Free | Value | Std | Min | Max | Linear
============== | ======= | ========== | ========== | ========== | ========== | ======
- A | True | 0.99682161 | 0.00219186 | None | None | True
- k | True | 1.01951706 | 0.09004865 | None | None | False
- x0 | True | -0.0084718 | 0.08091178 | None | None | False
+ A | True | 0.99976981 | 0.00211443 | None | None | True
+ k | True | 1.04261145 | 0.08938656 | None | None | False
+ x0 | True | -0.1259175 | 0.07728784 | None | None | False
@@ -91,7 +91,7 @@ Fit an arctan function.
.. rst-class:: sphx-glr-timing
- **Total running time of the script:** (0 minutes 0.362 seconds)
+ **Total running time of the script:** (0 minutes 0.361 seconds)
.. _sphx_glr_download_auto_examples_model_fitting_simple_arctan_fit.py:
diff --git a/_sources/sg_execution_times.rst.txt b/_sources/sg_execution_times.rst.txt
index d4f4bcf9e..b274238a5 100644
--- a/_sources/sg_execution_times.rst.txt
+++ b/_sources/sg_execution_times.rst.txt
@@ -6,7 +6,7 @@
Computation times
=================
-**00:08.435** total execution time for 3 files **from all galleries**:
+**00:10.273** total execution time for 3 files **from all galleries**:
.. container::
@@ -33,11 +33,11 @@ Computation times
- Time
- Mem (MB)
* - :ref:`sphx_glr_auto_examples_model_fitting_EELS_curve_fitting.py` (``../examples/model_fitting/EELS_curve_fitting.py``)
- - 00:07.511
+ - 00:09.313
- 0.0
* - :ref:`sphx_glr_auto_examples_model_fitting_plot_residual.py` (``../examples/model_fitting/plot_residual.py``)
- - 00:00.562
+ - 00:00.599
- 0.0
* - :ref:`sphx_glr_auto_examples_model_fitting_simple_arctan_fit.py` (``../examples/model_fitting/simple_arctan_fit.py``)
- - 00:00.362
+ - 00:00.361
- 0.0
diff --git a/_static/basic.css b/_static/basic.css
index e760386bd..2af6139e6 100644
--- a/_static/basic.css
+++ b/_static/basic.css
@@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
- * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
+ * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
diff --git a/_static/doctools.js b/_static/doctools.js
index d06a71d75..4d67807d1 100644
--- a/_static/doctools.js
+++ b/_static/doctools.js
@@ -4,7 +4,7 @@
*
* Base JavaScript utilities for all Sphinx HTML documentation.
*
- * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
+ * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
diff --git a/_static/language_data.js b/_static/language_data.js
index 250f5665f..367b8ed81 100644
--- a/_static/language_data.js
+++ b/_static/language_data.js
@@ -5,7 +5,7 @@
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*
- * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
+ * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -13,7 +13,7 @@
var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
-/* Non-minified version is copied as a separate JS file, is available */
+/* Non-minified version is copied as a separate JS file, if available */
/**
* Porter Stemmer
diff --git a/_static/searchtools.js b/_static/searchtools.js
index 7918c3fab..92da3f8b2 100644
--- a/_static/searchtools.js
+++ b/_static/searchtools.js
@@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for the full-text search.
*
- * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
+ * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -99,7 +99,7 @@ const _displayItem = (item, searchTerms, highlightTerms) => {
.then((data) => {
if (data)
listItem.appendChild(
- Search.makeSearchSummary(data, searchTerms)
+ Search.makeSearchSummary(data, searchTerms, anchor)
);
// highlight search terms in the summary
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
@@ -116,8 +116,8 @@ const _finishSearch = (resultCount) => {
);
else
Search.status.innerText = _(
- `Search finished, found ${resultCount} page(s) matching the search query.`
- );
+ "Search finished, found ${resultCount} page(s) matching the search query."
+ ).replace('${resultCount}', resultCount);
};
const _displayNextItem = (
results,
@@ -137,6 +137,22 @@ const _displayNextItem = (
// search finished, update title and status message
else _finishSearch(resultCount);
};
+// Helper function used by query() to order search results.
+// Each input is an array of [docname, title, anchor, descr, score, filename].
+// Order the results by score (in opposite order of appearance, since the
+// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically.
+const _orderResultsByScoreThenName = (a, b) => {
+ const leftScore = a[4];
+ const rightScore = b[4];
+ if (leftScore === rightScore) {
+ // same score: sort alphabetically
+ const leftTitle = a[1].toLowerCase();
+ const rightTitle = b[1].toLowerCase();
+ if (leftTitle === rightTitle) return 0;
+ return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
+ }
+ return leftScore > rightScore ? 1 : -1;
+};
/**
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a
@@ -160,13 +176,26 @@ const Search = {
_queued_query: null,
_pulse_status: -1,
- htmlToText: (htmlString) => {
+ htmlToText: (htmlString, anchor) => {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
- htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() });
+ for (const removalQuery of [".headerlinks", "script", "style"]) {
+ htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
+ }
+ if (anchor) {
+ const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`);
+ if (anchorContent) return anchorContent.textContent;
+
+ console.warn(
+ `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.`
+ );
+ }
+
+ // if anchor not specified or not found, fall back to main content
const docContent = htmlElement.querySelector('[role="main"]');
- if (docContent !== undefined) return docContent.textContent;
+ if (docContent) return docContent.textContent;
+
console.warn(
- "Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template."
+ "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template."
);
return "";
},
@@ -239,16 +268,7 @@ const Search = {
else Search.deferQuery(query);
},
- /**
- * execute search (requires search index to be loaded)
- */
- query: (query) => {
- const filenames = Search._index.filenames;
- const docNames = Search._index.docnames;
- const titles = Search._index.titles;
- const allTitles = Search._index.alltitles;
- const indexEntries = Search._index.indexentries;
-
+ _parseQuery: (query) => {
// stem the search terms and add them to the correct list
const stemmer = new Stemmer();
const searchTerms = new Set();
@@ -284,16 +304,32 @@ const Search = {
// console.info("required: ", [...searchTerms]);
// console.info("excluded: ", [...excludedTerms]);
- // array of [docname, title, anchor, descr, score, filename]
- let results = [];
+ return [query, searchTerms, excludedTerms, highlightTerms, objectTerms];
+ },
+
+ /**
+ * execute search (requires search index to be loaded)
+ */
+ _performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => {
+ const filenames = Search._index.filenames;
+ const docNames = Search._index.docnames;
+ const titles = Search._index.titles;
+ const allTitles = Search._index.alltitles;
+ const indexEntries = Search._index.indexentries;
+
+ // Collect multiple result groups to be sorted separately and then ordered.
+ // Each is an array of [docname, title, anchor, descr, score, filename].
+ const normalResults = [];
+ const nonMainIndexResults = [];
+
_removeChildren(document.getElementById("search-progress"));
- const queryLower = query.toLowerCase();
+ const queryLower = query.toLowerCase().trim();
for (const [title, foundTitles] of Object.entries(allTitles)) {
- if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) {
+ if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
for (const [file, id] of foundTitles) {
let score = Math.round(100 * queryLower.length / title.length)
- results.push([
+ normalResults.push([
docNames[file],
titles[file] !== title ? `${titles[file]} > ${title}` : title,
id !== null ? "#" + id : "",
@@ -308,46 +344,47 @@ const Search = {
// search for explicit entries in index directives
for (const [entry, foundEntries] of Object.entries(indexEntries)) {
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
- for (const [file, id] of foundEntries) {
- let score = Math.round(100 * queryLower.length / entry.length)
- results.push([
+ for (const [file, id, isMain] of foundEntries) {
+ const score = Math.round(100 * queryLower.length / entry.length);
+ const result = [
docNames[file],
titles[file],
id ? "#" + id : "",
null,
score,
filenames[file],
- ]);
+ ];
+ if (isMain) {
+ normalResults.push(result);
+ } else {
+ nonMainIndexResults.push(result);
+ }
}
}
}
// lookup as object
objectTerms.forEach((term) =>
- results.push(...Search.performObjectSearch(term, objectTerms))
+ normalResults.push(...Search.performObjectSearch(term, objectTerms))
);
// lookup as search terms in fulltext
- results.push(...Search.performTermsSearch(searchTerms, excludedTerms));
+ normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms));
// let the scorer override scores with a custom scoring function
- if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item)));
-
- // now sort the results by score (in opposite order of appearance, since the
- // display function below uses pop() to retrieve items) and then
- // alphabetically
- results.sort((a, b) => {
- const leftScore = a[4];
- const rightScore = b[4];
- if (leftScore === rightScore) {
- // same score: sort alphabetically
- const leftTitle = a[1].toLowerCase();
- const rightTitle = b[1].toLowerCase();
- if (leftTitle === rightTitle) return 0;
- return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
- }
- return leftScore > rightScore ? 1 : -1;
- });
+ if (Scorer.score) {
+ normalResults.forEach((item) => (item[4] = Scorer.score(item)));
+ nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item)));
+ }
+
+ // Sort each group of results by score and then alphabetically by name.
+ normalResults.sort(_orderResultsByScoreThenName);
+ nonMainIndexResults.sort(_orderResultsByScoreThenName);
+
+ // Combine the result groups in (reverse) order.
+ // Non-main index entries are typically arbitrary cross-references,
+ // so display them after other results.
+ let results = [...nonMainIndexResults, ...normalResults];
// remove duplicate search results
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
@@ -361,7 +398,12 @@ const Search = {
return acc;
}, []);
- results = results.reverse();
+ return results.reverse();
+ },
+
+ query: (query) => {
+ const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query);
+ const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms);
// for debugging
//Search.lastresults = results.slice(); // a copy
@@ -466,14 +508,18 @@ const Search = {
// add support for partial matches
if (word.length > 2) {
const escapedWord = _escapeRegExp(word);
- Object.keys(terms).forEach((term) => {
- if (term.match(escapedWord) && !terms[word])
- arr.push({ files: terms[term], score: Scorer.partialTerm });
- });
- Object.keys(titleTerms).forEach((term) => {
- if (term.match(escapedWord) && !titleTerms[word])
- arr.push({ files: titleTerms[word], score: Scorer.partialTitle });
- });
+ if (!terms.hasOwnProperty(word)) {
+ Object.keys(terms).forEach((term) => {
+ if (term.match(escapedWord))
+ arr.push({ files: terms[term], score: Scorer.partialTerm });
+ });
+ }
+ if (!titleTerms.hasOwnProperty(word)) {
+ Object.keys(titleTerms).forEach((term) => {
+ if (term.match(escapedWord))
+ arr.push({ files: titleTerms[term], score: Scorer.partialTitle });
+ });
+ }
}
// no match but word was a required one
@@ -496,9 +542,8 @@ const Search = {
// create the mapping
files.forEach((file) => {
- if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1)
- fileMap.get(file).push(word);
- else fileMap.set(file, [word]);
+ if (!fileMap.has(file)) fileMap.set(file, [word]);
+ else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word);
});
});
@@ -549,8 +594,8 @@ const Search = {
* search summary for a given text. keywords is a list
* of stemmed words.
*/
- makeSearchSummary: (htmlText, keywords) => {
- const text = Search.htmlToText(htmlText);
+ makeSearchSummary: (htmlText, keywords, anchor) => {
+ const text = Search.htmlToText(htmlText, anchor);
if (text === "") return null;
const textLower = text.toLowerCase();
diff --git a/auto_examples/index.html b/auto_examples/index.html
index 231dbc9b5..fb372595a 100644
--- a/auto_examples/index.html
+++ b/auto_examples/index.html
@@ -42,7 +42,7 @@
-
+
@@ -565,7 +565,7 @@ Model fitting