Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Explorer: Add basic implementation of "not contains" search type #519

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/amalthea/src/comm/data_explorer_comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,10 @@ pub enum TextSearchType {
#[strum(to_string = "contains")]
Contains,

#[serde(rename = "not_contains")]
#[strum(to_string = "not_contains")]
NotContains,

#[serde(rename = "starts_with")]
#[strum(to_string = "starts_with")]
StartsWith,
Expand Down
6 changes: 6 additions & 0 deletions crates/ark/src/modules/positron/r_data_explorer.R
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ col_filter_indices <- function(col, idx = NULL) {
grepl(pattern = escaped_term, col, fixed = FALSE, ignore.case = !params$case_sensitive)
}

# Search for the term not contained in the column's values
else if (identical(params$search_type, "not_contains")) {
escaped_term <- .ps.regex_escape(params$term)
!grepl(pattern = escaped_term, col, fixed = FALSE, ignore.case = !params$case_sensitive)
}

# Search for the term at the beginning of the column's values
else if (identical(params$search_type, "starts_with")) {
escaped_term <- .ps.regex_escape(params$term)
Expand Down
Loading