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

Bulk Search and List Creator #9279

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

benbdeitch
Copy link
Contributor

Closes #7653

With this PR, the long-requested Bulk Search feature is finally functional. It enables users to extract books and titles from sections of text, and search the Open LIbrary database for each pair, at the click of a button. ChatGPT-based extraction is functional, but requires the user to supply their own key for that purpose.

Technical

The majority of the changes involve the addition of a new Vue component. Rather than conveying information between individual components by event watchers, information is instead conveyed through a state defined in /openlibrary/components/BulkSearch/utils/classes.js.

Currently, the 'create a new list' function is not supported, but I intend to resolve that within the next few days.

Unfortunately, there were some limitations with how the table displays. Horizontal scrolling will likely be needed to navigate it, in cases where there are a large amount of works retrieved by a given search. This will likely be addressed in a future pull request.

Testing

Simply use the component, which is located at localhost:8080/bulk/search.

Screenshot

Stakeholders

@cdrini

@github-actions github-actions bot added the Priority: 2 Important, as time permits. [managed] label May 16, 2024
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

Nice great work @benbdeitch ! Did a first pass 👍

Main notes:

  • I think you forgot to add the BulkSearch.vue file! 😁
  • Can you format the vue files? I'm not sure why it's not causing eslint troubles 🤔 But it's a little hard to read. I'd recommend installing the Vue offical VS code extension ( https://marketplace.visualstudio.com/items?itemName=Vue.volar ) and then for each file, run auto form shift-alt-f

openlibrary/components/BulkSearch/components/BookCard.vue Outdated Show resolved Hide resolved
openlibrary/components/BulkSearch/components/TableRow.vue Outdated Show resolved Hide resolved
openlibrary/components/BulkSearch/utils/classes.js Outdated Show resolved Hide resolved
openlibrary/templates/bulk_search/demo.html Show resolved Hide resolved
openlibrary/templates/bulk_search/demo.html Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.12%. Comparing base (db9ead2) to head (0540dbb).
Report is 294 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9279      +/-   ##
==========================================
+ Coverage   15.89%   16.12%   +0.23%     
==========================================
  Files          90       92       +2     
  Lines        4732     4768      +36     
  Branches      824      828       +4     
==========================================
+ Hits          752      769      +17     
- Misses       3468     3481      +13     
- Partials      512      518       +6     

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

Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

Awesome this is looking great! A few code fixes / bugs!

<template>
<div>
<BulkSearchControls :bulkSearchState="bulkSearchState" />
<MatchTable :bulkSearchState="bulkSearchState" :listUrl = bulkSearchState.listUrl />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't show the match table if there are no extracted books at the beginning

<template>
<div class="book-card">
<div class="cover">
<img :src="coverImage">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<img :src="coverImage">
<img :src="coverImage" loading="lazy">

<template>
<div>
<BulkSearchControls :bulkSearchState="bulkSearchState" />
<MatchTable :bulkSearchState="bulkSearchState" :listUrl = bulkSearchState.listUrl />
Copy link
Collaborator

@cdrini cdrini Jun 11, 2024

Choose a reason for hiding this comment

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

Add an <hr /> between these two

textarea {
width: 100%;
display: flex;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
display: flex;
display: flex;
resize: vertical;
box-sizing: border-box;



<template>
<details open>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Give this a class name like bulk-search-controls and give it padding: 20px in style. That should tighten up this UI enough I reckon!

<option value="4">GPT</option>
</select></label>
<label v-if="bulkSearchState.extractionOptions.use_gpt">API-Key:
<input type="text" v-model="bulkSearchState.extractionOptions.api_key" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<input type="text" v-model="bulkSearchState.extractionOptions.api_key" />
<input type="password" v-model="bulkSearchState.extractionOptions.api_key" />

},
data() {
return {
OL_SEARCH_BASE: 'openlibrary.org',
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unused

},
data() {
return {
OL_SEARCH_BASE: 'openlibrary.org',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused

<td>{{ bookMatch.extractedBook.author }}</td>
<td>
<div class="bookCards">
<a :href="searchUrl">L</a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<a :href="searchUrl">L</a>
<a :href="searchUrl" title="View results in Open Library">🔎</a>

</label>
<SampleBar @sample="(msg) => bulkSearchState.inputText = msg" />
<label>
<input checked v-model="bulkSearchState.matchOptions.includeAuthor" type="checkbox" /> Use author in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't specify this since it's defined by includeAuthor

Suggested change
<input checked v-model="bulkSearchState.matchOptions.includeAuthor" type="checkbox" /> Use author in
<input v-model="bulkSearchState.matchOptions.includeAuthor" type="checkbox" /> Use author in

@cdrini cdrini added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] Priority: 2 Important, as time permits. [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bulk Search & List Creator
3 participants