mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 13:24:27 +01:00
Display the number of candidates instead of the returned document count
This commit is contained in:
parent
510df4729c
commit
aa129dd7e8
@ -26,7 +26,7 @@ $('#query, #facet').on('input', function () {
|
|||||||
|
|
||||||
let timeSpent = request.getResponseHeader('Time-Ms');
|
let timeSpent = request.getResponseHeader('Time-Ms');
|
||||||
let numberOfDocuments = data.documents.length;
|
let numberOfDocuments = data.documents.length;
|
||||||
count.innerHTML = `${numberOfDocuments}`;
|
count.innerHTML = data.numberOfCandidates.toLocaleString();
|
||||||
time.innerHTML = `${timeSpent}ms`;
|
time.innerHTML = `${timeSpent}ms`;
|
||||||
time.classList.remove('fade-in-out');
|
time.classList.remove('fade-in-out');
|
||||||
|
|
||||||
|
@ -633,6 +633,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct Answer {
|
struct Answer {
|
||||||
documents: Vec<Map<String, Value>>,
|
documents: Vec<Map<String, Value>>,
|
||||||
|
number_of_candidates: u64,
|
||||||
facets: HashMap<String, Vec<Value>>,
|
facets: HashMap<String, Vec<Value>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,6 +660,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
let SearchResult { found_words, candidates, documents_ids } = search.execute().unwrap();
|
let SearchResult { found_words, candidates, documents_ids } = search.execute().unwrap();
|
||||||
|
|
||||||
|
let number_of_candidates = candidates.len();
|
||||||
let facets = if query.facet_distribution == Some(true) {
|
let facets = if query.facet_distribution == Some(true) {
|
||||||
Some(index.facets(&rtxn).candidates(candidates).execute().unwrap())
|
Some(index.facets(&rtxn).candidates(candidates).execute().unwrap())
|
||||||
} else {
|
} else {
|
||||||
@ -690,6 +692,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
let answer = Answer {
|
let answer = Answer {
|
||||||
documents,
|
documents,
|
||||||
|
number_of_candidates,
|
||||||
facets: facets.unwrap_or_default(),
|
facets: facets.unwrap_or_default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
<nav class="level-right">
|
<nav class="level-right">
|
||||||
<div class="level-item has-text-centered">
|
<div class="level-item has-text-centered">
|
||||||
<div>
|
<div>
|
||||||
<p class="heading">Documents</p>
|
<p class="heading">Candidates</p>
|
||||||
<p id="count" class="title">0</p>
|
<p id="count" class="title">0</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user