Skip to content

Fulltext Suggestion Macro for 0 Results#9734

Merged
mekarpeles merged 6 commits intointernetarchive:masterfrom
merwhite11:1001/fulltext-search-box
Aug 20, 2024
Merged

Fulltext Suggestion Macro for 0 Results#9734
mekarpeles merged 6 commits intointernetarchive:masterfrom
merwhite11:1001/fulltext-search-box

Conversation

@merwhite11
Copy link
Copy Markdown
Collaborator

Closes #1001

Feature:
Creates a partial that is rendered within work_search.html in the case when 0 results are returned from a search.

The Fulltext-Search-Suggestion partial retrieves data from the Partials endpoint and renders a card with two suggestions of books with fulltext snippets that match the user's query. If the suggested book or title is clicked, it leads to the book's page. If the fulltext snippet or header/footer is clicked, it leads to the Search Inside results page.

Edge Cases:

  • If there are no results for a given Search Tab AND no Search Inside results -> Only the 'No results' message will appear, no Search Inside suggestions
  • All Search categories (books, authors, subjects, lists) return a Search Inside suggestion card if there are 0 category results
  • All Search categories return a consistent 'No results' message if there are no category results and no Search Inside matches.

Measuring Effectiveness:

  1. Does the Suggestion Card result in more people using Search Inside?
    • Check stats for Search Inside page to see if there in a jump in traffic after deployment
  2. Are people using the Suggestion Card?

Technical

In order to test the card, I added a json of sample data to conf
I then referenced the sample data in lending.py.

I 'uploaded' books through the command line by running these commands:
docker compose exec -e PYTHONPATH=. web bash
./scripts/copydocs.py /books/OL32090209M
./scripts/copydocs.py /books/OL24375865M
./scripts/copydocs.py /books/OL24204364M

I did not commit the json of sample data or the addition to lending.py.

Testing

Happy case:

  • Type in a search to the search bar under 'Books' that will likely return 0 results eg 'a cricket in the night' -> Search Inside suggestions will appear
  • Repeat the search in authors, subjects and lists categories -> Search Inside suggestions will appear

Edge case:

  • Type in a complete gibberish search in books, authors, search inside, subjects and lists categories -> Consistent 'No results' message will appear, no Search Inside suggestions

Screenshot

Happy case: A loading indicator will appear beneath 'No results found', and then will be replaced with this card:
Screenshot 2024-07-18 at 4 08 23 PM

Edge case: If there are no Search Inside matches, only the 'No results' message will appear
Screenshot 2024-07-18 at 4 11 15 PM

Stakeholders

@jimchamp @mekarpeles @cdrini

@github-actions github-actions bot added the Priority: 2 Important, as time permits. [managed] label Aug 12, 2024
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 0% with 43 lines in your changes missing coverage. Please review.

Project coverage is 16.45%. Comparing base (ce16a79) to head (dbbde6e).
Report is 337 commits behind head on master.

Files with missing lines Patch % Lines
...ugins/openlibrary/js/fulltext-search-suggestion.js 0.00% 33 Missing and 6 partials ⚠️
openlibrary/plugins/openlibrary/js/index.js 0.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9734      +/-   ##
==========================================
+ Coverage   16.06%   16.45%   +0.39%     
==========================================
  Files          90       91       +1     
  Lines        4769     4897     +128     
  Branches      832      853      +21     
==========================================
+ Hits          766      806      +40     
- Misses       3480     3557      +77     
- Partials      523      534      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@mekarpeles mekarpeles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 1 question about an i18n string containing a closing </a>
  • A handful of cases where we're using !important css rules that I'd prefer we avoid

Otherwise, ready to merge!

@merwhite11 merwhite11 force-pushed the 1001/fulltext-search-box branch 2 times, most recently from dee955d to a9e40fc Compare August 15, 2024 23:37
Created macro, not inserting into work_search html
Response from partial loading in macro

Basic outline for card
Added in pseucode for data call plan
Partial querying db and sending back data
Trying to get macro to render, not working
Can't create FulltextSearchBox macro, 500 error

Adding partial with data to DOM !
Deleted some console.logs
Author last name and covers loading in macro
Attempting to get author name
Redesigned mobile style w flex, truncated text, quotes

Resolved conflict-Book title blue and underlined

Styling changes

LoadingIndicator displaying which results fetching
i18n quotes, header and footer option

Cleaning up code

Fixed linter errors

Fixed js test error

Corrected more js test errors

Removed print out

Added i18n syntax

Added blue hover to quote link
Fixed header alignment, page num fix, tab specific message, authors
@mekarpeles mekarpeles force-pushed the 1001/fulltext-search-box branch from d4388b7 to 2cfb69c Compare August 20, 2024 19:06
@mekarpeles mekarpeles force-pushed the 1001/fulltext-search-box branch from dc06e79 to dbbde6e Compare August 20, 2024 19:09
@mekarpeles mekarpeles merged commit 078cdf8 into internetarchive:master Aug 20, 2024
mekarpeles added a commit that referenced this pull request Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 2 Important, as time permits. [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Search Results Experience when 0 results

4 participants