summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Tay <sam.chong.tay@gmail.com>2020-06-18 14:59:01 -0700
committerSam Tay <sam.chong.tay@gmail.com>2020-06-18 14:59:01 -0700
commit93d11aacd886ddedac176cd1b6fd92029d470a89 (patch)
treec9750348e8439ae8f2d0c4a3a1935c7b6f65462b
parent412676f8c99a93ee879c9c127a58b32dae50cdfa (diff)
For --lucky, only search first configured site
-rw-r--r--src/stackexchange.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/stackexchange.rs b/src/stackexchange.rs
index 77e8647..b6c6a16 100644
--- a/src/stackexchange.rs
+++ b/src/stackexchange.rs
@@ -91,9 +91,13 @@ impl StackExchange {
}
/// Search query at stack exchange and get the top answer body
+ ///
+ /// For now, use only the first configured site, since, parodoxically, sites
+ /// with the worst results will finish executing first, since there's less
+ /// data to retrieve.
pub async fn search_lucky(&self) -> Result<String> {
Ok(self
- .search_advanced(1)
+ .search_advanced_site(self.config.sites.iter().next().unwrap(), 1)
.await?
.into_iter()
.next()