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

Create new columns in table user_saved_search #3537

Closed
2 tasks
chouinar opened this issue Jan 15, 2025 · 1 comment · Fixed by #3671
Closed
2 tasks

Create new columns in table user_saved_search #3537

chouinar opened this issue Jan 15, 2025 · 1 comment · Fixed by #3671
Assignees

Comments

@chouinar
Copy link
Collaborator

chouinar commented Jan 15, 2025

To the DB we want to make the following two changes. Add a last_modified_at column like so:

last_notified_at: Mapped[datetime] = mapped_column(
        nullable=False,
        default=datetime_util.utcnow,
        server_default=sqlnow(),
    )

Also add an int array column for opportunity IDs to be stored (this doesn't need to be any sort of foreign key), call this searched_opportunity_ids

Acceptance criteria

  • DB table updated to include two new columns
  • Factories created/updated
@babebe
Copy link
Collaborator

babebe commented Jan 28, 2025

Split this work into 2 different tickets

Summary

We want to:

  • Modify the users query to replace the pagination with exactly{"order_by": "post_date", "page_offset": 1, "page_size": 1000, "sort_direction": "descending"}

  • Query the search index with this query, limiting the results to only opportunity ID

  • Store the list of opportunity IDs returned to the DB as a list/array (does not need to point to opportunity table as foreign keys)

We want to change the users query so that we have a relatively consistent set of results and don't have to factor in whatever they were sorting by / how much they were limiting / page number. Effectively we want the 1000 most recent results.

We'll later use this information in a backend job to determine changed search queries

@babebe babebe moved this from In Progress to In Review in Simpler.Grants.gov Product Backlog Jan 28, 2025
@babebe babebe changed the title Modify the endpoint where we save user searches to also query the search index and get opportunity IDs Create new columns in table user_saved_search Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants