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

Add scoring algorithm for history suggestions (extracted from BSK) #4341

Conversation

CrisBarreiro
Copy link
Contributor

@CrisBarreiro CrisBarreiro commented Mar 21, 2024

Task/Issue URL: https://app.asana.com/0/0/1206816228247419/f

Description

Copy the scoring algorithm from BSK

Steps to test this PR

Bookmarks shouldn't show in top hits (top section, above DDG suggestions)

  • Add wikipedia.org as a bookmark (not favorite)
  • Type wiki on the search bar
  • Check the newly added bookmark is not shown in top hits, and is instead shown in the bottom section (below DDG suggestions)

Favorites should show in top hits

  • Add wikipedia.org as a favorite
  • Type wiki on the search bar
  • Check the newly added favorite is shown in top hits and uses the bookmark+favorite icon

Steps to test this PR

Test pixel fired when selecting a favorite

  • Select a favorite from autocomplete
  • Check m_autocomplete_favorite_selection has been fired

Test pixel fired when selecting a bookmark

  • Select a bookmark from autocomplete
  • Checkk m_aut_s_b has been fired

Website (not SERP)

  • Visit a page (not SERP)
  • Open the history database using inspector or flipper, and check there's a new entry in history_entries. Take note of the ID. Check the title field contains the same title as the tab, the query field is empty and isSerp is 0
  • Check there's an entry in visits_list with that same historyEntryId
  • Reload the page
  • Check the history_entries table still has only one entry for that site
  • Check the visits_list contains 2 entries for that same historyEntryId

SERP

  • Perform a search
  • Open the history database using inspector or flipper, and check there's a new entry in history_entries. Take note of the ID. Check the title field contains the same title as the tab, the query field contains your query, and isSerp is 0
  • Check there's an entry in visits_list with that same historyEntryId
  • Reload the page
  • Check the history_entries table still has only one entry for that site (In some cases, reload doesn't produce the same exact query params,* in case a second entry is added, check URLs are different)
  • Check the visits_list contains 2 entries for that same historyEntryId

DuckDuckGo URL (not SERP)

Clear app data between tests, fire button doesn't clear history
(yet)

Feature 1

  • Visit wikipedia.org
  • Type wiki
  • Check a history result is shown for wikipedia.org

Feature 2

Feature 3

  • Add a random site as a bookmark
  • Then go to bookmarks and edit it, Set https://wikipedia.org as the
    URL and Wikipedia as the title
  • Type wiki
  • Check wikipedia is shown on the bottom section with a bookmark
    icon, not in top hits
  • Visit wikipedia.org
  • Check now wikipedia is shown in top hits with the bookmark icon

Feature 4

  • Add a random site as a favorite
  • Then go to bookmarks and edit it, Set https://wikipedia.org as the
    URL and Wikipedia as the title
  • Type wiki
  • Check now wikipedia is shown in top hits with the favorite icon

Feature 5

  • Type something on the search bar
  • Check history/bookmark/favorite suggestions aren't shown before
    search suggestions are loaded

Feature 6

  • Type something on the search bar
  • Quickly delete everything
  • Check history/bookmark/favorite suggestions aren't shown before
    search suggestions and no "No suggestions found" message is shown either

UI changes

Video
favorites
bookmarks

Copy link
Contributor Author

CrisBarreiro commented Mar 21, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @CrisBarreiro and the rest of your teammates on Graphite Graphite

@CrisBarreiro CrisBarreiro mentioned this pull request Mar 21, 2024
41 tasks
@CrisBarreiro CrisBarreiro marked this pull request as ready for review April 2, 2024 16:13
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/history-entry branch from 3ac0113 to 6aef9e2 Compare April 10, 2024 13:31
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/history-score branch from 8c14ea4 to 6b90bd5 Compare April 10, 2024 13:31
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/history-entry branch from 6aef9e2 to 461d2f9 Compare April 10, 2024 17:26
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/history-score branch from 6b90bd5 to 5b68c24 Compare April 10, 2024 17:26
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/history-entry branch from 461d2f9 to 3acb1a7 Compare April 11, 2024 10:49
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/history-score branch from 5b68c24 to 0d3e8d8 Compare April 11, 2024 10:49
Task/Issue URL: https://app.asana.com/0/0/1206840141125560/f 

### Description
Add support for bottom section. Auto-complete suggestions are divided as
follows:
1. Top hits (Top 2 results from favorites)
2. Search suggestions
3. Other favorites and bookmarks

### Steps to test this PR

_Bookmarks shouldn't show in top hits (top section, above DDG
suggestions)_
- [ ] Add wikipedia.org as a bookmark (not favorite)
- [ ] Type wiki on the search bar
- [ ] Check the newly added bookmark is not shown in top hits, and is
instead shown in the bottom section (below DDG suggestions)

_Favorites should show in top hits_
- [ ] Add wikipedia.org as a favorite
- [ ] Type wiki on the search bar
- [ ] Check the newly added favorite is shown in top hits and uses the
bookmark+favorite icon

### Steps to test this PR

_Test pixel fired when selecting a favorite_
- [ ] Select a favorite from autocomplete
- [ ] Check m_autocomplete_favorite_selection has been fired

_Test pixel fired when selecting a bookmark_
- [ ] Select a bookmark from autocomplete
- [ ] Checkk m_aut_s_b has been fired

_Website (not SERP)_
- [ ] Visit a page (not SERP)
- [ ] Open the history database using inspector or flipper, and check
there's a new entry in `history_entries`. Take note of the ID. Check the
title field contains the same title as the tab, the query field is empty
and `isSerp` is 0
- [ ] Check there's an entry in `visits_list` with that same
`historyEntryId`
- [ ] Reload the page
- [ ] Check the `history_entries` table still has only one entry for
that site
- [ ] Check the `visits_list` contains 2 entries for that same
`historyEntryId`

_SERP_
- [ ] Perform a search
- [ ] Open the history database using inspector or flipper, and check
there's a new entry in `history_entries`. Take note of the ID. Check the
title field contains the same title as the tab, the query field contains
your query, and `isSerp` is 0
- [ ] Check there's an entry in `visits_list` with that same
`historyEntryId`
- [ ] Reload the page
- [ ] Check the `history_entries` table still has only one entry for
that site (In some cases, reload doesn't produce the same exact query
params,* in case a second entry is added, check URLs are different)
- [ ] Check the `visits_list` contains 2 entries for that same
`historyEntryId`

_DuckDuckGo URL (not SERP)_
- [ ] Visit https://duckduckgo.com/settings
- [ ] Open the history database using inspector or flipper, and check
the query field is empty and `isSerp` is 0

**Clear app data between tests, fire button doesn't clear history
(yet)**

_Feature 1_
- [ ] Visit wikipedia.org
- [ ] Type wiki
- [ ] Check a history result is shown for wikipedia.org

_Feature 2_
- [ ] Visit https://en.wikipedia.org/wiki/Cat
- [ ] Type wiki
- [ ] Check there's no top hits result for Cat at wikipedia
- [ ] Visit https://en.wikipedia.org/wiki/Cat 3 more times
- [ ] Check there's a top hits result for Cat at wikipedia

_Feature 3_
- [ ] Add a random site as a bookmark
- [ ] Then go to bookmarks and edit it, Set https://wikipedia.org as the
URL and Wikipedia as the title
- [ ] Type wiki
- [ ] Check wikipedia is shown on the bottom section with a bookmark
icon, not in top hits
- [ ] Visit wikipedia.org
- [ ] Check now wikipedia is shown in top hits with the bookmark icon

_Feature 4_
- [ ] Add a random site as a favorite
- [ ] Then go to bookmarks and edit it, Set https://wikipedia.org as the
URL and Wikipedia as the title
- [ ] Type wiki
- [ ] Check now wikipedia is shown in top hits with the favorite icon

_Feature 5_

- [ ] Type something on the search bar
- [ ] Check history/bookmark/favorite suggestions aren't shown before
search suggestions are loaded

_Feature 6_
- [ ] Type something on the search bar
- [ ] Quickly delete everything
- [ ] Check history/bookmark/favorite suggestions aren't shown before
search suggestions and no "No suggestions found" message is shown either

### UI changes
[No UI
changes](https://github.com/duckduckgo/Android/assets/6297834/645d3666-82a0-490a-9bf6-02901d14a117)

![favorites](https://github.com/duckduckgo/Android/assets/6297834/c142ec6b-ff0f-4ce9-8cc1-a1864d5a4de1)

![bookmarks](https://github.com/duckduckgo/Android/assets/6297834/945a9cb4-5f9d-4beb-9a07-953403d9251f)
@CrisBarreiro CrisBarreiro merged commit 054fbce into feature/cbarreiro/autocomplete/history-entry Apr 30, 2024
4 checks passed
@CrisBarreiro CrisBarreiro deleted the feature/cbarreiro/autocomplete/history-score branch April 30, 2024 09:55
CrisBarreiro added a commit that referenced this pull request Apr 30, 2024
…4341)

Task/Issue URL: https://app.asana.com/0/0/1206816228247419/f 

### Description
Copy the scoring algorithm from BSK

### Steps to test this PR
_Bookmarks shouldn't show in top hits (top section, above DDG
suggestions)_
- [ ] Add wikipedia.org as a bookmark (not favorite)
- [ ] Type wiki on the search bar
- [ ] Check the newly added bookmark is not shown in top hits, and is
instead shown in the bottom section (below DDG suggestions)

_Favorites should show in top hits_
- [ ] Add wikipedia.org as a favorite
- [ ] Type wiki on the search bar
- [ ] Check the newly added favorite is shown in top hits and uses the
bookmark+favorite icon

### Steps to test this PR

_Test pixel fired when selecting a favorite_
- [ ] Select a favorite from autocomplete
- [ ] Check m_autocomplete_favorite_selection has been fired

_Test pixel fired when selecting a bookmark_
- [ ] Select a bookmark from autocomplete
- [ ] Checkk m_aut_s_b has been fired

_Website (not SERP)_
- [ ] Visit a page (not SERP)
- [ ] Open the history database using inspector or flipper, and check
there's a new entry in `history_entries`. Take note of the ID. Check the
title field contains the same title as the tab, the query field is empty
and `isSerp` is 0
- [ ] Check there's an entry in `visits_list` with that same
`historyEntryId`
- [ ] Reload the page
- [ ] Check the `history_entries` table still has only one entry for
that site
- [ ] Check the `visits_list` contains 2 entries for that same
`historyEntryId`

_SERP_
- [ ] Perform a search
- [ ] Open the history database using inspector or flipper, and check
there's a new entry in `history_entries`. Take note of the ID. Check the
title field contains the same title as the tab, the query field contains
your query, and `isSerp` is 0
- [ ] Check there's an entry in `visits_list` with that same
`historyEntryId`
- [ ] Reload the page
- [ ] Check the `history_entries` table still has only one entry for
that site (In some cases, reload doesn't produce the same exact query
params,* in case a second entry is added, check URLs are different)
- [ ] Check the `visits_list` contains 2 entries for that same
`historyEntryId`

_DuckDuckGo URL (not SERP)_
- [ ] Visit https://duckduckgo.com/settings
- [ ] Open the history database using inspector or flipper, and check
the query field is empty and `isSerp` is 0

**Clear app data between tests, fire button doesn't clear history
(yet)**

_Feature 1_
- [ ] Visit wikipedia.org
- [ ] Type wiki
- [ ] Check a history result is shown for wikipedia.org

_Feature 2_
- [ ] Visit https://en.wikipedia.org/wiki/Cat
- [ ] Type wiki
- [ ] Check there's no top hits result for Cat at wikipedia
- [ ] Visit https://en.wikipedia.org/wiki/Cat 3 more times
- [ ] Check there's a top hits result for Cat at wikipedia

_Feature 3_
- [ ] Add a random site as a bookmark
- [ ] Then go to bookmarks and edit it, Set https://wikipedia.org as the
URL and Wikipedia as the title
- [ ] Type wiki
- [ ] Check wikipedia is shown on the bottom section with a bookmark
icon, not in top hits
- [ ] Visit wikipedia.org
- [ ] Check now wikipedia is shown in top hits with the bookmark icon

_Feature 4_
- [ ] Add a random site as a favorite
- [ ] Then go to bookmarks and edit it, Set https://wikipedia.org as the
URL and Wikipedia as the title
- [ ] Type wiki
- [ ] Check now wikipedia is shown in top hits with the favorite icon

_Feature 5_

- [ ] Type something on the search bar
- [ ] Check history/bookmark/favorite suggestions aren't shown before
search suggestions are loaded

_Feature 6_
- [ ] Type something on the search bar
- [ ] Quickly delete everything
- [ ] Check history/bookmark/favorite suggestions aren't shown before
search suggestions and no "No suggestions found" message is shown either

### UI changes

[Video](https://github.com/duckduckgo/Android/assets/6297834/645d3666-82a0-490a-9bf6-02901d14a117)

![favorites](https://github.com/duckduckgo/Android/assets/6297834/c142ec6b-ff0f-4ce9-8cc1-a1864d5a4de1)

![bookmarks](https://github.com/duckduckgo/Android/assets/6297834/945a9cb4-5f9d-4beb-9a07-953403d9251f)
CrisBarreiro added a commit that referenced this pull request May 15, 2024
…4341)

Task/Issue URL: https://app.asana.com/0/0/1206816228247419/f 

### Description
Copy the scoring algorithm from BSK

### Steps to test this PR
_Bookmarks shouldn't show in top hits (top section, above DDG
suggestions)_
- [ ] Add wikipedia.org as a bookmark (not favorite)
- [ ] Type wiki on the search bar
- [ ] Check the newly added bookmark is not shown in top hits, and is
instead shown in the bottom section (below DDG suggestions)

_Favorites should show in top hits_
- [ ] Add wikipedia.org as a favorite
- [ ] Type wiki on the search bar
- [ ] Check the newly added favorite is shown in top hits and uses the
bookmark+favorite icon

### Steps to test this PR

_Test pixel fired when selecting a favorite_
- [ ] Select a favorite from autocomplete
- [ ] Check m_autocomplete_favorite_selection has been fired

_Test pixel fired when selecting a bookmark_
- [ ] Select a bookmark from autocomplete
- [ ] Checkk m_aut_s_b has been fired

_Website (not SERP)_
- [ ] Visit a page (not SERP)
- [ ] Open the history database using inspector or flipper, and check
there's a new entry in `history_entries`. Take note of the ID. Check the
title field contains the same title as the tab, the query field is empty
and `isSerp` is 0
- [ ] Check there's an entry in `visits_list` with that same
`historyEntryId`
- [ ] Reload the page
- [ ] Check the `history_entries` table still has only one entry for
that site
- [ ] Check the `visits_list` contains 2 entries for that same
`historyEntryId`

_SERP_
- [ ] Perform a search
- [ ] Open the history database using inspector or flipper, and check
there's a new entry in `history_entries`. Take note of the ID. Check the
title field contains the same title as the tab, the query field contains
your query, and `isSerp` is 0
- [ ] Check there's an entry in `visits_list` with that same
`historyEntryId`
- [ ] Reload the page
- [ ] Check the `history_entries` table still has only one entry for
that site (In some cases, reload doesn't produce the same exact query
params,* in case a second entry is added, check URLs are different)
- [ ] Check the `visits_list` contains 2 entries for that same
`historyEntryId`

_DuckDuckGo URL (not SERP)_
- [ ] Visit https://duckduckgo.com/settings
- [ ] Open the history database using inspector or flipper, and check
the query field is empty and `isSerp` is 0

**Clear app data between tests, fire button doesn't clear history
(yet)**

_Feature 1_
- [ ] Visit wikipedia.org
- [ ] Type wiki
- [ ] Check a history result is shown for wikipedia.org

_Feature 2_
- [ ] Visit https://en.wikipedia.org/wiki/Cat
- [ ] Type wiki
- [ ] Check there's no top hits result for Cat at wikipedia
- [ ] Visit https://en.wikipedia.org/wiki/Cat 3 more times
- [ ] Check there's a top hits result for Cat at wikipedia

_Feature 3_
- [ ] Add a random site as a bookmark
- [ ] Then go to bookmarks and edit it, Set https://wikipedia.org as the
URL and Wikipedia as the title
- [ ] Type wiki
- [ ] Check wikipedia is shown on the bottom section with a bookmark
icon, not in top hits
- [ ] Visit wikipedia.org
- [ ] Check now wikipedia is shown in top hits with the bookmark icon

_Feature 4_
- [ ] Add a random site as a favorite
- [ ] Then go to bookmarks and edit it, Set https://wikipedia.org as the
URL and Wikipedia as the title
- [ ] Type wiki
- [ ] Check now wikipedia is shown in top hits with the favorite icon

_Feature 5_

- [ ] Type something on the search bar
- [ ] Check history/bookmark/favorite suggestions aren't shown before
search suggestions are loaded

_Feature 6_
- [ ] Type something on the search bar
- [ ] Quickly delete everything
- [ ] Check history/bookmark/favorite suggestions aren't shown before
search suggestions and no "No suggestions found" message is shown either

### UI changes

[Video](https://github.com/duckduckgo/Android/assets/6297834/645d3666-82a0-490a-9bf6-02901d14a117)

![favorites](https://github.com/duckduckgo/Android/assets/6297834/c142ec6b-ff0f-4ce9-8cc1-a1864d5a4de1)

![bookmarks](https://github.com/duckduckgo/Android/assets/6297834/945a9cb4-5f9d-4beb-9a07-953403d9251f)
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.

None yet

2 participants