From e98ee5170f18d83fdecf4f32a3c0e55870cccf61 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sun, 1 May 2016 13:28:09 +0800 Subject: [PATCH] Search results limited to 500. --- src/page.h | 15 +++++++++++++-- src/templates/search_results.html | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/page.h b/src/page.h index 2586ed8..dc8d8d5 100644 --- a/src/page.h +++ b/src/page.h @@ -1189,6 +1189,7 @@ namespace xmreg { mstch::map context { {"search_text", search_text}, {"no_results" , true}, + {"to_many_results", false} }; for (const pair>& found_txs: all_possible_tx_hashes) @@ -1204,7 +1205,9 @@ namespace xmreg { = context.insert({found_txs.first, mstch::array{}}); if (!found_txs.second.empty()) - { + { + + uint64_t tx_i {0}; // for each found tx_hash, get the corresponding tx // and its details, and put into mstch for rendering @@ -1221,11 +1224,19 @@ namespace xmreg { tx_details txd = get_tx_details(tx); boost::get((res.first)->second).push_back(txd.get_mstch_map()); + + // dont show more than 500 results + if (tx_i > 500) + { + context["to_many_results"] = true; + break; + } + + ++tx_i; } // if found something, set this flag to indicate this fact context["no_results"] = false; - } } diff --git a/src/templates/search_results.html b/src/templates/search_results.html index 57a2de5..30a3ed7 100644 --- a/src/templates/search_results.html +++ b/src/templates/search_results.html @@ -7,6 +7,10 @@ and there might be 1-2 min delay betweem my blockchain others {{/no_results}} + {{#to_many_results}} +

More than 500 results found. Showing no more than this

+ {{/to_many_results}} +
{{#has_key_images}}