Page MenuHomePhabricator

[User Story US-4] Reader runs a Dive query and sees passage results (Android)
Closed, ResolvedPublic2 Estimated Story Points

Description

User Story

  • As a reader
  • I want to tap Dive and get passages from inside articles that answer my query
  • So that I do not have to open several articles and skim them myself

Where in the flow: Dive bottom sheet, raised from clicking the entry point in the result list over the search screen.

Acceptance criteria

  • Tapping the feature in the list raises a bottom sheet with a grabber, the title "Dive", the Beta pill, and a close control.
  • Sheet header layout is the same on both platforms: title and Beta pill left-aligned, close control on the right.
  • The sheet opens at a medium height and expands to full when the reader drags the grabber. On iOS this is the medium and large detents per Apple’s sheet guidance; Android implements equivalent behaviour.
  • The sheet does not repeat the query. It is sized so the reader’s query stays visible on the screen behind or above it — that is what carries the context, and it is the stated reason for opening at medium.
  • A loading state is shown while results are in flight (native behaviour)
  • On success, passage cards are rendered in returned order; ranking is not re-sorted client-side.
  • An empty result set shows a distinct empty state, not an error.
  • Error states are handled and distinguishable: general failure, rate limiting, and backend unavailable.
  • An in-flight request is cancelled if the reader dismisses the sheet. Keyboard isn’t active when bottom sheet is up.
  • The sheet is dismissible by grabber drag-down, close control, scrim tap, and the platform back gesture, and returns the reader to the search screen with the entry point, the query, and the autocomplete list intact.
  • Result count, logs, good abandonment parameters (talk to Shay)  and latency are logged per query.

Notes and open questions

  • The medium-first height is load-bearing for the decision not to repeat the query. If a platform cannot keep the query visible at that height, that is a design decision to make, not a silent fallback to echoing the query in the sheet.
  • The prototype calls the MediaWiki Action API per language host; the production surface points at the Phase 2 semantic endpoint.
  • The mockups show two to three cards at full height. Confirm the maximum number of passages and whether the sheet paginates, lazy-loads, or truncates.

Out of scope

Follow-up or conversational querying inside the sheet.
Generated or summarised answers — passages are word for word only.

Design

iOS and Android - https://www.figma.com/design/s3KF9DqhJg2aAHpZBS8lwg/iOS---Android---%3E-Semantic-Search-%7C-Phase-2?node-id=5985-35300&t=lRnznnewYVAmkn1L-11

API Details

Semantic search call:

https://{lang}.wikipedia.org/w/api.php?action=query&format=json&generator=search&gsrprop=snippet%7Csectiontitle%7Credirecttitle&cirrusSemanticSearch=hl&gsrsearch={searchText}&gsrwhat=text&gsrnamespace=0&prop=pageimages&piprop=thumbnail&gsrlimit=3&errorsuselocal=1&errorformat=html&formatversion=2

Note the cirrusSemanticSearch=hl param - it triggers semantic search instead of lexical, and an hl value returns highlighted text within <span class=\"searchmatch\"></span> tags.

We should page results when the user reaches the bottom of the results, fetch the next 3 using a gsroffset= parameter.

For each search result:

  1. You will fetch thumbnail data to populate the image, as usual

Both the contributor and reference count data will come from the Attribution API, using a call like this:

https://{lang}.wikipedia.org/w/rest.php/attribution/v0-beta/pages/{title}/signals?redirect=true&expand=trust_and_relevance

  1. To populate contributor count, fetch and use contributor_count. Just a note that this currently returns null in the API, but it is on track to be implemented by the end of September.
  2. To populate references count, we will go with two approaches: A: For FR and JA Wiki, use the reference_count data point in https://{lang}.wikipedia.org/w/rest.php/attribution/v0-beta/pages/{title}/signals?redirect=true&expand=trust_and_relevance. B: For AR Wiki, use the last_updated data point in https://{lang}.wikipedia.org/w/rest.php/attribution/v0-beta/pages/{title}/signals?redirect=true&expand=trust_and_relevance. We will want to switch the label to Last Updated: (check with Design). We are falling back to last_updated date as a trust signal for now, because most AR Wiki reference_counts are currently null. Those are slated to be fixed around early November. We might make a followup task to switch AR Wiki back to reference_counts, if the experiment is still running.

Event Timeline

Eng sync questions:

  • Title "Dive"...can we update Figma to match?
  • what happens when user taps chevron?
  • We need empty state mockup
  • "Error states are handled and distinguishable: general failure, rate limiting, and backend unavailable." - do we display a toast, would that be okay? Can we have a mockup of this?
  • Blue banner on top (thumbs up, thumbs down), is that a part of this task?
  • Is highlighting a part of this task? When will the API be ready for that?
  • How will we get contributor and reference counts? Toni to answer.
  • Should we support pagination? Android supported top 3 last time, no paging.

Design for this is mostly ready other than:

  • Screen title will be 'Dive' not 'Find'
  • And we do not yet have an empty result set showing a distinct empty state, not an error - this will be coming soon
  • For the 'skeleton loading' - iOS and Android Engineers to suggest native behaviour to Tais if you have something that already exists? If so then send to Tais.

Is highlighting a part of this task? When will the API be ready for that?
How will we get contributor and reference counts? Toni to answer.

We think we can estimate this as-is and we can deal with these more complicated questions as a part of T437041: [User Story US-5] Reader can tell where a passage came from and who wrote it (Android).

Another Q:

Do we need to support long press on these search results? (Open in new tab, Save for later, etc).

ABendall-WMF renamed this task from [User Story] Reader runs a Dive query and sees passage results to [User Story US-4] Reader runs a Dive query and sees passage results.Sep 8 2026, 7:54 PM

iOS: 5
Android: 5

Note: We are going to estimate and tackle the trickier bits in a different task: T437041: [User Story US-5] Reader can tell where a passage came from and who wrote it (Android)

  • highlighting
  • collapsing
  • contributor/reference counts
  • images
Tsevener renamed this task from [User Story US-4] Reader runs a Dive query and sees passage results to [User Story US-4] Reader runs a Dive query and sees passage results (Android).Sep 8 2026, 9:21 PM
Tsevener set the point value for this task to 5.
Seddon changed the point value for this task from 5 to 4.Sep 16 2026, 4:52 PM
Seddon set Final Story Points to 5.
cooltey added a subscriber: TLessa-WMF.

Hi @TLessa-WMF

The implementation is ready for review, please download the APK to see it.
https://github.com/wikimedia/apps-android-wikipedia/pull/6875

To test, please first go to the dev settings:

  1. semanticSearchEnabled: must be ON
  2. semanticSearchFirstUse: can be ON or OFF
  3. semanticSearchOverrideSupportLanguage -> ON = All languages enabled | OFF = ar, ja, fr only
  4. semanticSearchIsTestActive: must be ON
  5. semantic-search-phase-2: must equal 1

Hi @TLessa-WMF

An empty result set shows a distinct empty state, not an error.

Japanese is currently unavailable for semantic search requests, and this is expected. The API returns an error because it does not support JA yet.

Hi @TLessa-WMF

Please download the APK from the PR below to see the changes and let me know if you have questions. Thank you.
https://github.com/wikimedia/apps-android-wikipedia/pull/6875

Seddon changed the point value for this task from 4 to 2.Sep 30 2026, 4:19 PM

Toni said that @JTannerWMF will review the semantic search tickets in 'Design Review' in place of Tais (since she's OOO for two weeks and Sarah is busy before going on leave for 2 weeks) and then move them to QA review

Kicking this back because the quotes in LTR languages are incorrect. See here for more details.

Hi @JTannerWMF

From the Slack thread, there's another thread where we agreed on using the font quotation symbol based on their language instead of using the same curly quote.
https://wikimedia.slack.com/archives/C0BB6A2NS6A/p1790028453850099?thread_ts=1790025488.338129&cid=C0BB6A2NS6A

ABorbaWMF subscribed.

Testing on 50611-alpha-2026-10-08
Tested on:
Pixel 8, Android 16
Galaxy A36, Android 15

Requirement✅❓❌Notes
Tapping the feature in the list raises a bottom sheet with a grabber, the title "Dive", the Beta pill, and a close control.✅Works as expected
Sheet header layout is the same on both platforms: title and Beta pill left-aligned, close control on the right.✅Works as expected
The sheet opens at a medium height and expands to full when the reader drags the grabber. On iOS this is the medium and large detents per Apple’s sheet guidance; Android implements equivalent behaviour.✅Works as expected
The sheet does not repeat the query. It is sized so the reader’s query stays visible on the screen behind or above it — that is what carries the context, and it is the stated reason for opening at medium.✅Works as expected
A loading state is shown while results are in flight (native behaviour)✅Works as expected
On success, passage cards are rendered in returned order; ranking is not re-sorted client-side.✅Works as expected
An empty result set shows a distinct empty state, not an error.❓I was not able to create an empty state even with random characters
Error states are handled and distinguishable: general failure, rate limiting, and backend unavailable.❓I couldn't create an error state. I was able to create a network failure error, but that message appears before I can engage dive
An in-flight request is cancelled if the reader dismisses the sheet. Keyboard isn’t active when bottom sheet is up.✅Works as expected
The sheet is dismissible by grabber drag-down, close control, scrim tap, and the platform back gesture, and returns the reader to the search screen with the entry point, the query, and the autocomplete list intact.✅Works as expected
Result count, logs, good abandonment parameters (talk to Shay) and latency are logged per query.❓Assuming this is for data, should be checked by User-SNowick_WMF