Repository: internetarchive/openlibrary

Issue:
Unable to render this page Error when no parameters are passed to search page.
Unable to render this page Error occurs when no parameters are passed to ```/search``` . It should redirect to a dedicated search page instead of showing the error.

### Evidence / Screenshot 
<img width="875" alt="image" src="https://github.com/internetarchive/openlibrary/assets/117273351/5a219337-1dfb-4b96-a74d-ab97014fbb57">


### Relevant url
https://openlibrary.org/search

### Steps to Reproduce
<!-- What steps caused you to find the bug? -->
1. Go to ...
2. Do ...

<!-- What actually happened after these steps? What did you expect to happen? -->
* Actual:
* Expected:

### Details

- **Logged in (Y/N)?**
- **Browser type/version?**
- **Operating system?**
- **Environment (prod/dev/local)?** prod
<!-- If not sure, put prod -->

### Proposal & Constraints
<!-- What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere? -->

### Related files
<!-- Files related to this issue; this is super useful for new contributors who might want to help! If you're not sure, leave this blank; a maintainer will add them. -->

### Stakeholders
<!-- @ tag stakeholders of this bug -->



Discussion:
@mekarpeles can i work on this issue.
Closing my duplicate issue now, but pasting some info from it below in case it helps with the fix:
> ### Steps to Reproduce
> 1. Click on "Advanced" in the main search bar
> 2. Click on "Books" in the menu
> 
> Or navigate directly to https://openlibrary.org/search
> 
> * Actual: Error message, no page rendered.
> * Expected: Search page like the others in the menu:
> 
> <img alt="Screenshot 2024-01-23 at 1 09 30 PM" width="500" src="https://private-user-images.githubusercontent.com/140550988/299055877-52a20d79-86d7-4eb3-8243-f3b39a1b45bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDYxMDE4NzAsIm5iZiI6MTcwNjEwMTU3MCwicGF0aCI6Ii8xNDA1NTA5ODgvMjk5MDU1ODc3LTUyYTIwZDc5LTg2ZDctNGViMy04MjQzLWYzYjM5YTFiNDViZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMTI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDEyNFQxMzA2MTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01MzNkNWM4OGExMDIwZTFjMzEwMjdjZDFkZjQ3Mjg1NTJmMjViMzljYzIwYmQ4ODcwY2Y2ZDE1ZDQyOTk0YTk4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.lfCfiwEVdT-3Q8TjwePCAqglxbaaBFsbprQKPVyPk3Q">
>
> ### Details
> * **Logged in (Y/N)?** 
> Y & N (happens in both cases)
> * **Environment (prod/dev/local)?** 
>  prod (but happens in dev as well)
> 
> ### Proposal & Constraints
> On further investigation, I've discovered that the page does render if there is something entered into the top search bar, so it seems what is needed is to either a. make or b. find/relink a default book search page that matches the others in the menu (see image above) and renders without a search term.
> 
> This would be especially helpful to users who put in /search after the URL to try to start a search (or navigate over the way I did).
> 
> ### Related files
> `openlibrary/templates/work_search.html` ([link](https://github.com/internetarchive/openlibrary/blob/master/openlibrary/templates/work_search.html))
> `openlibrary/templates/search` ([folder of other search page templates](https://github.com/internetarchive/openlibrary/tree/master/openlibrary/templates/search))
Is anyone working on this? Is it ok if I pick this up?

Resolving patch:
diff --git a/openlibrary/plugins/worksearch/code.py b/openlibrary/plugins/worksearch/code.py
--- a/openlibrary/plugins/worksearch/code.py
+++ b/openlibrary/plugins/worksearch/code.py
@@ -19,7 +19,6 @@
 from openlibrary.core import cache
 from openlibrary.core.lending import add_availability
 from openlibrary.core.models import Edition
-from openlibrary.plugins.inside.code import fulltext_search
 from openlibrary.plugins.openlibrary.processors import urlsafe
 from openlibrary.plugins.upstream.utils import (
     get_language_name,
@@ -491,11 +490,14 @@ def GET(self):
         page = int(param.get('page', 1))
         sort = param.get('sort', None)
         rows = 20
-        search_response: SearchResponse | None = None
         if param:
             search_response = do_search(
                 param, sort, page, rows=rows, spellcheck_count=3
             )
+        else:
+            search_response = SearchResponse(
+                facet_counts=None, sort='', docs=[], num_found=0, solr_select=''
+            )
         return render.work_search(
             ' '.join(q_list),
             search_response,


Test patch: