adsabs / biblib-service

ADS library service
https://ui.adsabs.harvard.edu
MIT License
4 stars 8 forks source link

Add bibcode validation to "add documents to library" function #158

Closed kelockhart closed 1 year ago

kelockhart commented 2 years ago

Issue: When adding bibcodes to a library via the API, there is no check to make sure the bibcodes being added are valid, so a user can accidentally add junk to their library. This junk is then invisible in the UI view, and can only be viewed/removed via the API again.

Two possible solutions:

  1. Add a Solr verification step to the add_document_to_library function (or similar). Only add bibcodes that are in Solr to the library.

    • Cons: This might be slow, especially if a lot of bibcodes are being added. Also, this is unnecessary if bibcodes are being added via the UI, since only valid bibcodes are accessible there. Also, if the bibcodes are already the result of a search (in the UI or API), we're basically querying Solr twice for the same results.
  2. Two parts: First part, do solution 1 above. Second part, add another "add documents" function that accepts a query instead of a list of bibcodes. This function would add all the results of the query to the library. Since it's a query, we already know the bibcodes are valid, so we don't need to check them again - this would be faster.

tjacovich commented 2 years ago

Also issue #131