Skip to content

Conversation

@david-allison
Copy link
Member

@david-allison david-allison commented Jan 11, 2026

Purpose / Description

In this PR, I implement a draft of the 'Advanced Search' functionality for the Card Browser.

As this is development-only functionality, I would ideally like this merged without productionizing the draft functionality. That being said, please heavily review the intent and the existing code.

I plan to productionize this by adding dialog boxes to the provided options, enabling (for example): selection of valid fields in a drop-down list or autocompleting text view.

The main aim of this functionality is to expose Anki's search syntax to users, without them needing to read the manual.

Although we can use chips for a significant portion of common functionality, Anki's functionality is advanced:

  • Searches can include Regex or wildcards in unusual places:
    • fr*nt:text - search all fields matching the wildcard
    • deck:te*t - a deck search. Not easily representable in the 'deck' chip

So we will provide full text search functionality. Providing explanations, and builders for common functionality will improve discoverability of features, and gives us an opportunity to explain AnkiDroid's features

  • Card Properties
  • States
  • Events

If this screen passes code reviews, it is intended for various 'small' dialogs to be produced. For example: one which will provide the full list of valid fields to select from.

Fixes

Approach

  • Add an advanced mode & button
  • Add a tabbed UI
    • Each tab contains a RecyclerView, each row has a title and an example
    • For now, clicking the row inserts the example into the editText
    • Later, I would like to introduce dialogs for common operations

How Has This Been Tested?

screen-20260111-231015.mp4
  • Tested state restore & don't keep activities

Learning

https://docs.ankiweb.net/searching.html

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@david-allison david-allison changed the title feat(card-browser): Advanced Search [Dev only] feat(new-card-browser): Advanced Search [Dev only] Jan 11, 2026
@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Jan 12, 2026
This adds a wireframe for an advanced search mode in the Card Browser.

Basic operations should can be performed using chips, but advanced operations
 such as `deck:a*` would not be feasible to display.

The advanced mode provides discoverability of many operations which would
 otherwise only be available in the manual

Ignored in the test due to use of `FragmentContainerView`

Issue 18709
This commit adds a basic implementation of Advanced Searches:

An advanced search is just a string

UI:

* A list of categorized options is added in tabs
  * A category would be 'Tags'
  * An option has a title, and an example
  * example: Title: **Notes with no tags**; example: `tags:none`
  * When the option is clicked, the example is appended to the
    search text of the CardBrowserFragment

Strings are hardcoded, there will be a lot of nitpicks on functionality

Code reviews and future commits will replace some options with better
 functionality, this should be done before ossifying the strings via translations

Issue 18709
It's unexpected to keep old state when closing the
 search view
@david-allison david-allison removed the Needs Author Reply Waiting for a reply from the original author label Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant