mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-21 21:48:21 -05:00
✨ feat: add code to handle aggregation when no engines are selected (#227)
This commit is contained in:
parent
b428cedd7a
commit
173c6ba821
@ -195,16 +195,26 @@ async fn results(
|
|||||||
.filter_map(|name| EngineHandler::new(name))
|
.filter_map(|name| EngineHandler::new(name))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
aggregate(
|
match engines.is_empty() {
|
||||||
query,
|
false => {
|
||||||
page,
|
aggregate(
|
||||||
config.aggregator.random_delay,
|
query,
|
||||||
config.debug,
|
page,
|
||||||
&engines,
|
config.aggregator.random_delay,
|
||||||
config.request_timeout,
|
config.debug,
|
||||||
safe_search,
|
&engines,
|
||||||
)
|
config.request_timeout,
|
||||||
.await?
|
safe_search,
|
||||||
|
)
|
||||||
|
.await?
|
||||||
|
}
|
||||||
|
true => {
|
||||||
|
let mut search_results = SearchResults::default();
|
||||||
|
search_results.set_no_engines_selected();
|
||||||
|
search_results.set_page_query(query);
|
||||||
|
search_results
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
aggregate(
|
aggregate(
|
||||||
@ -219,7 +229,10 @@ async fn results(
|
|||||||
.await?
|
.await?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if results.engine_errors_info().is_empty() && results.results().is_empty() {
|
if results.engine_errors_info().is_empty()
|
||||||
|
&& results.results().is_empty()
|
||||||
|
&& !results.no_engines_selected()
|
||||||
|
{
|
||||||
results.set_filtered();
|
results.set_filtered();
|
||||||
}
|
}
|
||||||
results.add_style(&config.style);
|
results.add_style(&config.style);
|
||||||
|
Loading…
Reference in New Issue
Block a user