From 9b0826097f1e7e8f3446e4bd8f0dbeef4c9fb97f Mon Sep 17 00:00:00 2001 From: "james.balamuta@gmail.com" Date: Tue, 20 May 2025 13:49:49 -0700 Subject: [PATCH 1/4] Add bluesky and mastodon --- NAMESPACE | 3 ++ NEWS.md | 6 ++- R/index-sites.R | 11 ++++++ R/search-functions.R | 52 +++++++++++++++++++++++--- README.Rmd | 27 ++++++++++--- README.md | 26 ++++++++++--- man/search_bluesky.Rd | 32 ++++++++++++++++ man/search_mastodon.Rd | 32 ++++++++++++++++ man/search_posit_community.Rd | 2 + man/search_site.Rd | 8 ++-- man/search_stackoverflow.Rd | 6 ++- man/search_twitter.Rd | 9 ++++- man/searcher.Rd | 2 +- tests/testthat/test-search-functions.R | 30 +++++++++++++++ 14 files changed, 220 insertions(+), 26 deletions(-) create mode 100644 man/search_bluesky.Rd create mode 100644 man/search_mastodon.Rd diff --git a/NAMESPACE b/NAMESPACE index e8db0f2..0e92b8a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,6 +16,7 @@ export(ask_perplexity) export(search_bb) export(search_bing) export(search_bitbucket) +export(search_bluesky) export(search_brave) export(search_ddg) export(search_duckduckgo) @@ -25,6 +26,7 @@ export(search_github) export(search_google) export(search_grep) export(search_kagi) +export(search_mastodon) export(search_posit) export(search_posit_community) export(search_qwant) @@ -35,4 +37,5 @@ export(search_sp) export(search_stackoverflow) export(search_startpage) export(search_twitter) +export(search_x) export(searcher) diff --git a/NEWS.md b/NEWS.md index e3e6fb1..0c9a94b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -24,6 +24,10 @@ ([#42](https://github.com/coatless-rpkg/searcher/pull/42)) - `search_kagi()`: Searches on Kagi. ([#42](https://github.com/coatless-rpkg/searcher/pull/42)) + - `search_mastodon()`: Searches on Mastodon. + ([#44](https://github.com/coatless-rpkg/searcher/pull/44)) + - `search_bluesky()`: Searches on BlueSky. + ([#44](https://github.com/coatless-rpkg/searcher/pull/44)) - Added searcher logo ([#40](https://github.com/coatless-rpkg/searcher/pull/40)) ## Documentation @@ -49,7 +53,7 @@ - Deprecated `search_rstudio_community()` and `search_rscom()` functions. ([#43](https://github.com/coatless-rpkg/searcher/pull/43)) - These functions are now replaced by `search_posit_community()`/`search_posit()` - which searches [Posit Community](https://community.posit.co/search). + which searches [Posit Community](https://forum.posit.co/search). # searcher 0.0.7 diff --git a/R/index-sites.R b/R/index-sites.R index a167c2e..4480c0f 100644 --- a/R/index-sites.R +++ b/R/index-sites.R @@ -81,6 +81,17 @@ site_index = site_entry( "twitter", "https://twitter.com/search?q=", + "x", + keywords = keyword_entry("%23rstats", "%23rstats %23tidyverse") # %23 is # + ), + site_entry( + "mastodon", + "https://mastodon.social/search?q=", + keywords = keyword_entry("%23rstats", "%23rstats %23tidyverse") # %23 is # + ), + site_entry( + "bluesky", + "https://bsky.app/search?q=", keywords = keyword_entry("%23rstats", "%23rstats %23tidyverse") # %23 is # ), site_entry( diff --git a/R/search-functions.R b/R/search-functions.R index d7558f2..d10bb31 100644 --- a/R/search-functions.R +++ b/R/search-functions.R @@ -8,7 +8,7 @@ #' `"startpage"` (formerly `"ixquick"`) or `"sp"`, #' `"qwant"`, `"rseek"`, `"brave"`, `"kagi"`, #' `"posit community"` (formerly `"rstudio community"`) or `"posit"`, -#' `"twitter"`, `"stackoverflow"`, +#' `"twitter"` or `"x"`, `"bluesky"`, `"mastodon"`, `"stackoverflow"`, #' `"github"`, `"grep"`, `"bitbucket"`, #' `"chatgpt"`, `"claude"`, `"perplexity"`, #' `"mistral"`, `"bing copilot"` or `"copilot"`, and @@ -40,6 +40,9 @@ search_site = function(query, "posit community", "posit", "twitter", + "x", + "bluesky", + "mastodon", "stackoverflow", "so", "github", @@ -75,7 +78,10 @@ search_site = function(query, kagi = search_kagi(query, rlang), `posit community` = , # empty case carried below posit = search_posit_community(query, rlang), - twitter = search_twitter(query, rlang), + twitter = , # empty case carried below + x = search_twitter(query, rlang), + bluesky = search_bluesky(query, rlang), + mastodon = search_mastodon(query, rlang), stackoverflow = , # empty case carried below so = search_stackoverflow(query, rlang), github = , # empty case carried below @@ -320,14 +326,14 @@ search_posit_community = searcher("posit") #' @export search_posit = search_posit_community -#' Search Twitter +#' Search Twitter/X #' #' The `search_twitter()` functions search #' Twitter using: `https://twitter.com/search?q=` #' #' For additional details regarding Twitter's #' search interface please see: -#' +#' #' #' @inheritParams search_site #' @return The generated search URL or an empty string. @@ -338,6 +344,39 @@ search_posit = search_posit_community #' search_twitter("searcher") search_twitter = searcher("twitter") +#' @rdname search_twitter +#' @export +search_x = search_twitter + +#' Search Mastodon +#' +#' The `search_mastodon()` functions search +#' Mastodon using: `https://mastodon.social/search?q=%23rstats+` +#' +#' @inheritParams search_site +#' @return The generated search URL or an empty string. +#' @export +#' @family community sites +#' @examples +#' # Search Mastodon +#' search_mastodon("searcher") +search_mastodon = searcher("mastodon") + + +#' Search BlueSky +#' +#' The `search_bluesky()` functions search +#' BlueSky using: `https://bsky.app/search?q=%23rstats+` +#' +#' @inheritParams search_site +#' @return The generated search URL or an empty string. +#' @export +#' @family community sites +#' @examples +#' # Search BlueSky +#' search_bluesky("searcher") +search_bluesky = searcher("bluesky") + #' Search StackOverflow #' #' The `search_stackoverflow()` and `search_so()` functions both search @@ -346,7 +385,10 @@ search_twitter = searcher("twitter") #' #' For additional details regarding [StackOverflow](https://stackoverflow.com)'s #' search interface please see: -#' +#' +#' ``` +#' https://stackoverflow.com/help/searching +#' ``` #' #' @inheritParams search_site #' @return The generated search URL or an empty string. diff --git a/README.Rmd b/README.Rmd index b2da912..965db5e 100644 --- a/README.Rmd +++ b/README.Rmd @@ -12,13 +12,17 @@ knitr::opts_chunk$set( ) ``` -# searcher A hexagonal logo for searcher +# searcher A hexagonal logo for searcher + [![R-CMD-check](https://github.com/coatless-rpkg/searcher/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-rpkg/searcher/actions/workflows/R-CMD-check.yaml) [![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/searcher)](https://www.r-pkg.org/pkg/searcher) [![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/searcher)](https://cran.r-project.org/package=searcher) +## Overview + + The goal of `searcher` is to provide a search interface directly inside of _R_. For example, to look up `rcpp example numeric vector` or `ggplot2 fix axis labels` call one of the `search_*()` functions to @@ -65,8 +69,9 @@ major search engines, programming help websites, and code repositories. The foll platforms are supported: [Google](https://www.google.com), [Bing](https://www.bing.com/), [DuckDuckGo](https://duckduckgo.com/), [Startpage](https://www.startpage.com/en/), Ecosia, [rseek](https://rseek.org/), Qwant, [Brave](https://search.brave.com/), -Kagi, X (formerly Twitter), [StackOverflow](https://stackoverflow.com/), -[Posit Community](https://community.posit.co/search), +Kagi, X (formerly Twitter), [BlueSky](https://bsky.app), [Mastodon](https://mastodon.social), +[StackOverflow](https://stackoverflow.com/), +[Posit Community](https://forum.posit.co/), [GitHub](https://github.com/search), [grep.app](https://grep.app/), and [BitBucket](https://bitbucket.org/product/). By default, an appropriate suffix for each platform that ensures relevant @@ -85,11 +90,19 @@ search_kagi("R project") search_duckduckgo("R project") # or search_ddg(...) search_startpage("R project") # or search_sp(...) -# Searching Twitter to find out about machine learning for R and in general +# Searching X/Twitter to find out about machine learning for R and in general search_twitter("machine learning") search_twitter("machine learning", rlang = FALSE) -# Searching for linear regression questions for R and in general +# Searching BlueSky to find out about deep learning for R and in general +search_bluesky("deep learning") +search_bluesky("deep learning", rlang = FALSE) + +# Searching Mastodon to find out about data visualization for R and in general +search_mastodon("data vis") +search_mastodon("data vis", rlang = FALSE) + +# Searching SO for linear regression questions for R and in general search_stackoverflow("linear regression") search_stackoverflow("linear regression", rlang = FALSE) # or search_so(...) @@ -184,8 +197,10 @@ search_rseek() search_qwant() search_brave() search_kagi() -search_twitter() search_grep() +search_mastodon() +search_bluesky() +search_twitter() # or search_x() search_duckduckgo() # or search_ddg() search_startpage() # or search_sp() search_stackoverflow() # or search_so() diff --git a/README.md b/README.md index cc22053..4ecd291 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# searcher A hexagonal logo for searcher +# searcher A hexagonal logo for searcher @@ -11,6 +11,8 @@ downloads](https://cranlogs.r-pkg.org/badges/searcher)](https://www.r-pkg.org/pk [![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/searcher)](https://cran.r-project.org/package=searcher) +## Overview + The goal of `searcher` is to provide a search interface directly inside of *R*. For example, to look up `rcpp example numeric vector` or `ggplot2 fix axis labels` call one of the `search_*()` functions to @@ -65,8 +67,10 @@ repositories. The following search platforms are supported: [DuckDuckGo](https://duckduckgo.com/), [Startpage](https://www.startpage.com/en/), Ecosia, [rseek](https://rseek.org/), Qwant, [Brave](https://search.brave.com/), -Kagi, X (formerly Twitter), [StackOverflow](https://stackoverflow.com/), -[Posit Community](https://community.posit.co/search), +Kagi, X (formerly Twitter), [BlueSky](https://bsky.app), +[Mastodon](https://mastodon.social), +[StackOverflow](https://stackoverflow.com/), [Posit +Community](https://forum.posit.co/), [GitHub](https://github.com/search), [grep.app](https://grep.app/), and [BitBucket](https://bitbucket.org/product/). By default, an appropriate suffix for each platform that ensures relevant results to *R* is @@ -85,11 +89,19 @@ search_kagi("R project") search_duckduckgo("R project") # or search_ddg(...) search_startpage("R project") # or search_sp(...) -# Searching Twitter to find out about machine learning for R and in general +# Searching X/Twitter to find out about machine learning for R and in general search_twitter("machine learning") search_twitter("machine learning", rlang = FALSE) -# Searching for linear regression questions for R and in general +# Searching BlueSky to find out about deep learning for R and in general +search_bluesky("deep learning") +search_bluesky("deep learning", rlang = FALSE) + +# Searching Mastodon to find out about data visualization for R and in general +search_mastodon("data vis") +search_mastodon("data vis", rlang = FALSE) + +# Searching SO for linear regression questions for R and in general search_stackoverflow("linear regression") search_stackoverflow("linear regression", rlang = FALSE) # or search_so(...) @@ -187,8 +199,10 @@ search_rseek() search_qwant() search_brave() search_kagi() -search_twitter() search_grep() +search_mastodon() +search_bluesky() +search_twitter() # or search_x() search_duckduckgo() # or search_ddg() search_startpage() # or search_sp() search_stackoverflow() # or search_so() diff --git a/man/search_bluesky.Rd b/man/search_bluesky.Rd new file mode 100644 index 0000000..d1492c6 --- /dev/null +++ b/man/search_bluesky.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/search-functions.R +\name{search_bluesky} +\alias{search_bluesky} +\title{Search BlueSky} +\usage{ +search_bluesky(query = geterrmessage(), rlang = TRUE) +} +\arguments{ +\item{query}{Contents of string to search. Default is the error message.} + +\item{rlang}{Search for results written in R. Default is \code{TRUE}} +} +\value{ +The generated search URL or an empty string. +} +\description{ +The \code{search_bluesky()} functions search +BlueSky using: \verb{https://bsky.app/search?q=\%23rstats+} +} +\examples{ +# Search BlueSky +search_bluesky("searcher") +} +\seealso{ +Other community sites: +\code{\link{search_mastodon}()}, +\code{\link{search_posit_community}()}, +\code{\link{search_stackoverflow}()}, +\code{\link{search_twitter}()} +} +\concept{community sites} diff --git a/man/search_mastodon.Rd b/man/search_mastodon.Rd new file mode 100644 index 0000000..6497c76 --- /dev/null +++ b/man/search_mastodon.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/search-functions.R +\name{search_mastodon} +\alias{search_mastodon} +\title{Search Mastodon} +\usage{ +search_mastodon(query = geterrmessage(), rlang = TRUE) +} +\arguments{ +\item{query}{Contents of string to search. Default is the error message.} + +\item{rlang}{Search for results written in R. Default is \code{TRUE}} +} +\value{ +The generated search URL or an empty string. +} +\description{ +The \code{search_mastodon()} functions search +Mastodon using: \verb{https://mastodon.social/search?q=\%23rstats+} +} +\examples{ +# Search Mastodon +search_mastodon("searcher") +} +\seealso{ +Other community sites: +\code{\link{search_bluesky}()}, +\code{\link{search_posit_community}()}, +\code{\link{search_stackoverflow}()}, +\code{\link{search_twitter}()} +} +\concept{community sites} diff --git a/man/search_posit_community.Rd b/man/search_posit_community.Rd index 2263b07..cab8387 100644 --- a/man/search_posit_community.Rd +++ b/man/search_posit_community.Rd @@ -33,6 +33,8 @@ search_posit_community("RStudio IDE") } \seealso{ Other community sites: +\code{\link{search_bluesky}()}, +\code{\link{search_mastodon}()}, \code{\link{search_stackoverflow}()}, \code{\link{search_twitter}()} } diff --git a/man/search_site.Rd b/man/search_site.Rd index 727a7bc..2a58659 100644 --- a/man/search_site.Rd +++ b/man/search_site.Rd @@ -7,9 +7,9 @@ search_site( query, site = c("google", "bing", "duckduckgo", "ddg", "startpage", "sp", "qwant", "rseek", - "brave", "kagi", "posit community", "posit", "twitter", "stackoverflow", "so", - "github", "gh", "grep", "bitbucket", "bb", "chatgpt", "claude", "perplexity", - "mistral", "bing copilot", "copilot", "meta ai", "meta"), + "brave", "kagi", "posit community", "posit", "twitter", "x", "bluesky", "mastodon", + "stackoverflow", "so", "github", "gh", "grep", "bitbucket", "bb", "chatgpt", + "claude", "perplexity", "mistral", "bing copilot", "copilot", "meta ai", "meta"), rlang = TRUE, prompt = NULL ) @@ -22,7 +22,7 @@ search_site( \code{"startpage"} (formerly \code{"ixquick"}) or \code{"sp"}, \code{"qwant"}, \code{"rseek"}, \code{"brave"}, \code{"kagi"}, \code{"posit community"} (formerly \code{"rstudio community"}) or \code{"posit"}, -\code{"twitter"}, \code{"stackoverflow"}, +\code{"twitter"} or \code{"x"}, \code{"bluesky"}, \code{"mastodon"}, \code{"stackoverflow"}, \code{"github"}, \code{"grep"}, \code{"bitbucket"}, \code{"chatgpt"}, \code{"claude"}, \code{"perplexity"}, \code{"mistral"}, \code{"bing copilot"} or \code{"copilot"}, and diff --git a/man/search_stackoverflow.Rd b/man/search_stackoverflow.Rd index e97ce2a..31ea0ed 100644 --- a/man/search_stackoverflow.Rd +++ b/man/search_stackoverflow.Rd @@ -25,7 +25,9 @@ The \code{search_stackoverflow()} and \code{search_so()} functions both search \details{ For additional details regarding \href{https://stackoverflow.com}{StackOverflow}'s search interface please see: -\url{https://stackoverflow.com/help/searching} + +\if{html}{\out{
}}\preformatted{https://stackoverflow.com/help/searching +}\if{html}{\out{
}} } \examples{ # Search StackOverflow for Convolutions in the r tag @@ -36,6 +38,8 @@ search_stackoverflow("convolutions", rlang = FALSE) } \seealso{ Other community sites: +\code{\link{search_bluesky}()}, +\code{\link{search_mastodon}()}, \code{\link{search_posit_community}()}, \code{\link{search_twitter}()} } diff --git a/man/search_twitter.Rd b/man/search_twitter.Rd index bfb4cbd..b1c6b35 100644 --- a/man/search_twitter.Rd +++ b/man/search_twitter.Rd @@ -2,9 +2,12 @@ % Please edit documentation in R/search-functions.R \name{search_twitter} \alias{search_twitter} -\title{Search Twitter} +\alias{search_x} +\title{Search Twitter/X} \usage{ search_twitter(query = geterrmessage(), rlang = TRUE) + +search_x(query = geterrmessage(), rlang = TRUE) } \arguments{ \item{query}{Contents of string to search. Default is the error message.} @@ -21,7 +24,7 @@ Twitter using: \verb{https://twitter.com/search?q=} \details{ For additional details regarding Twitter's search interface please see: -\url{https://help.twitter.com/en/using-x/x-advanced-search} +\url{https://help.x.com/en/using-x/x-advanced-search} } \examples{ # Search Twitter @@ -29,6 +32,8 @@ search_twitter("searcher") } \seealso{ Other community sites: +\code{\link{search_bluesky}()}, +\code{\link{search_mastodon}()}, \code{\link{search_posit_community}()}, \code{\link{search_stackoverflow}()} } diff --git a/man/searcher.Rd b/man/searcher.Rd index ad75361..157efe3 100644 --- a/man/searcher.Rd +++ b/man/searcher.Rd @@ -12,7 +12,7 @@ searcher(site, keyword = getOption("searcher.default_keyword")) \code{"startpage"} (formerly \code{"ixquick"}) or \code{"sp"}, \code{"qwant"}, \code{"rseek"}, \code{"brave"}, \code{"kagi"}, \code{"posit community"} (formerly \code{"rstudio community"}) or \code{"posit"}, -\code{"twitter"}, \code{"stackoverflow"}, +\code{"twitter"} or \code{"x"}, \code{"bluesky"}, \code{"mastodon"}, \code{"stackoverflow"}, \code{"github"}, \code{"grep"}, \code{"bitbucket"}, \code{"chatgpt"}, \code{"claude"}, \code{"perplexity"}, \code{"mistral"}, \code{"bing copilot"} or \code{"copilot"}, and diff --git a/tests/testthat/test-search-functions.R b/tests/testthat/test-search-functions.R index 1bfc4ed..5ae1c03 100644 --- a/tests/testthat/test-search-functions.R +++ b/tests/testthat/test-search-functions.R @@ -140,6 +140,36 @@ test_that("Check link generation - twitter", { }) +test_that("Check link generation - Mastodon", { + + expect_identical( + search_mastodon("toad"), + "https://mastodon.social/search?q=toad %23rstats" + ) + + expect_identical( + search_mastodon("toad", rlang = FALSE), + "https://mastodon.social/search?q=toad" + ) + +}) + +test_that("Check link generation - BlueSky", { + + expect_identical( + search_bluesky("toad"), + "https://bsky.app/search?q=toad %23rstats" + ) + + expect_identical( + search_bluesky("toad", rlang = FALSE), + "https://bsky.app/search?q=toad" + ) + +}) + + + test_that("Check link generation - stackoverflow", { expect_identical( From 2f298880ca60f696d649eb0adb39cef52d3b0cc8 Mon Sep 17 00:00:00 2001 From: "james.balamuta@gmail.com" Date: Tue, 20 May 2025 13:53:24 -0700 Subject: [PATCH 2/4] Fix posit forum url --- R/index-sites.R | 2 +- tests/testthat/test-search-functions.R | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/index-sites.R b/R/index-sites.R index 4480c0f..8360000 100644 --- a/R/index-sites.R +++ b/R/index-sites.R @@ -61,7 +61,7 @@ site_index = ), site_entry( "posit community", - "https://community.posit.co/search?q=", + "https://forum.posit.co/search?q=", "posit", NULL ), diff --git a/tests/testthat/test-search-functions.R b/tests/testthat/test-search-functions.R index 5ae1c03..708741b 100644 --- a/tests/testthat/test-search-functions.R +++ b/tests/testthat/test-search-functions.R @@ -115,12 +115,12 @@ test_that("Check link generation - Posit Community", { expect_identical( search_posit("toad"), - "https://community.posit.co/search?q=toad" + "https://forum.posit.co/search?q=toad" ) expect_identical( search_posit("toad", rlang = FALSE), - "https://community.posit.co/search?q=toad" + "https://forum.posit.co/search?q=toad" ) }) @@ -250,7 +250,7 @@ test_that("Validate selection short name - search_site", { expect_identical( search_site("toad", "posit", rlang = FALSE), - "https://community.posit.co/search?q=toad" + "https://forum.posit.co/search?q=toad" ) expect_identical( From 9bb6591c1fae88f89ff2156aad7274ce2e4c35b4 Mon Sep 17 00:00:00 2001 From: "james.balamuta@gmail.com" Date: Tue, 20 May 2025 13:54:12 -0700 Subject: [PATCH 3/4] Add to community --- _pkgdown.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_pkgdown.yml b/_pkgdown.yml index 5d5c8f2..f37129e 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -80,6 +80,8 @@ reference: - search_posit_community - search_posit - search_twitter + - search_bluesky + - search_mastodon - title: "Code Repositories" desc: > From b6268947ccdcc61440f790eb2e978531978d6f9d Mon Sep 17 00:00:00 2001 From: "james.balamuta@gmail.com" Date: Tue, 20 May 2025 13:56:00 -0700 Subject: [PATCH 4/4] 45 --- NEWS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 0c9a94b..aa8cd92 100644 --- a/NEWS.md +++ b/NEWS.md @@ -25,9 +25,9 @@ - `search_kagi()`: Searches on Kagi. ([#42](https://github.com/coatless-rpkg/searcher/pull/42)) - `search_mastodon()`: Searches on Mastodon. - ([#44](https://github.com/coatless-rpkg/searcher/pull/44)) + ([#45](https://github.com/coatless-rpkg/searcher/pull/45)) - `search_bluesky()`: Searches on BlueSky. - ([#44](https://github.com/coatless-rpkg/searcher/pull/44)) + ([#45](https://github.com/coatless-rpkg/searcher/pull/45)) - Added searcher logo ([#40](https://github.com/coatless-rpkg/searcher/pull/40)) ## Documentation