Skip to content

Conversation

@amanvatss
Copy link
Contributor

Feat: Unify Keyword and Semantic Search into "Search My Library" Page

**Closes: #31 **

This PR refactors the user-facing search experience by deprecating the two separate search pages (Query Stored Summaries and Semantic Search (FAISS)).

These have been replaced with a single, unified 📚 Search My Library page. This new interface provides a much cleaner UX by allowing the user to select their desired search mode (Keyword or Semantic) from a simple radio toggle before searching.

All existing functionality, including loading spinners and the various download options (TXT, MD, PDF), has been preserved and migrated to this new unified page.


Changes Made

In streamlit_app.py:

  • Removed Query Stored Summaries and Semantic Search (FAISS) from the st.radio sidebar options.
  • Added the new 📚 Search My Library option to the sidebar.
  • Removed the two elif blocks that rendered the old, separate search pages.
  • Added a new elif block for 📚 Search My Library.
  • This new page now contains:
    • A horizontal st.radio to select "Keyword" or "Semantic" mode.
    • A single st.text_input for the query.
    • A single 🔍 Search Library button.
  • Moved the Rebuild Index button (formerly on the "Semantic Search" page) into an st.expander on this new page.
  • Conditionally calls query_db or search_similar based on the selected search mode.
  • Migrated all result-rendering logic (expanders, download buttons) into the new conditional block.

How to Test

  1. Pull down this branch and run streamlit run streamlit_app.py.
  2. Observe the sidebar: "Query Stored Summaries" and "Semantic Search" should be gone.
  3. Click the new 📚 Search My Library option.
  4. Verify the new UI appears with the "Keyword" / "Semantic" toggle and a single search bar.
  5. Test Keyword Search:
    • Select "Keyword".
    • Enter a query you know is in your db.json.
    • Click "Search Library" and verify the correct results are returned.
    • Inside a result, test all three download buttons (TXT, MD, PDF).
  6. Test Semantic Search:
    • Select "Semantic".
    • Enter a conceptual query (e.g., "AI in medicine").
    • Click "Search Library" and verify the semantically-related results are returned.
    • Inside a result, test all three download buttons.
  7. Test Index Rebuild:
    • Open the 🗂️ Index Management expander.
    • Click 🔄 Rebuild Index and verify the loading animation plays and a success message appears.
  8. Test Other Pages:
    • Click "Search arXiv Papers," "Upload & Summarize PDF," and "History" to ensure they were not affected and still function perfectly.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR consolidates two separate search interfaces ("Query Stored Summaries" and "Semantic Search (FAISS)") into a single unified "Search My Library" page. Users can now toggle between keyword and semantic search modes within one streamlined interface, improving the overall user experience while maintaining all existing functionality.

Key Changes:

  • Removed two separate sidebar navigation options and replaced them with a single "📚 Search My Library" option
  • Implemented a radio button toggle allowing users to select between "Keyword" and "Semantic" search modes
  • Migrated all search result rendering and download functionality to the new unified page

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

# --- This is the logic from the old "Semantic Search (FAISS)" page ---
with st.spinner("Running semantic search..."):
try:
results = search_similar(query_input)
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

Inconsistent indentation detected. This line appears to have extra indentation compared to the surrounding code block. The indentation should align with other statements at the same nesting level (line 882 uses results = query_db(query_input) with consistent indentation).

Suggested change
results = search_similar(query_input)
results = search_similar(query_input)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Create a "Search My Library" Page to Unify Keyword and Semantic Search

1 participant