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

Make new aggregations searchable #131

Merged
merged 1 commit into from
Mar 7, 2024
Merged

Make new aggregations searchable #131

merged 1 commit into from
Mar 7, 2024

Conversation

jazairi
Copy link
Contributor

@jazairi jazairi commented Mar 7, 2024

Why these changes are being introduced:

We added some more aggregations as part of the ongoing work, but did
not add them to the query string or corresponding models.

Relevant ticket(s):

How this addresses that need:

This adds the new aggregations to the Enhancer and QueryBuilder models, and adds them to the query in the TimdexSearch model.

Side effects of this change:

  • VCR cassettes have been regenerated.
  • This is another instance of something that has come up recently: the need to develop an E2E testing strategy for our Rails apps, particularly those that are API consumers. We can test this using our standard VCR process, but that is likely to break when cassettes are regenerated and the search results change.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

@mitlib mitlib temporarily deployed to timdex-ui-pi-filter-bug-o97gox March 7, 2024 17:05 Inactive
@coveralls
Copy link

coveralls commented Mar 7, 2024

Pull Request Test Coverage Report for Build 8192124817

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.467%

Totals Coverage Status
Change from base Build 8162440823: 0.0%
Covered Lines: 373
Relevant Lines: 375

💛 - Coveralls

@jazairi jazairi temporarily deployed to timdex-ui-pi-filter-bug-o97gox March 7, 2024 17:08 Inactive
@jazairi jazairi temporarily deployed to timdex-ui-pi-filter-bug-o97gox March 7, 2024 17:11 Inactive
@jazairi
Copy link
Contributor Author

jazairi commented Mar 7, 2024

I'm treating this as a hotfix and merging it prior to review. I welcome a retroactive review and any suggestions/opinions on the testing front.

Why these changes are being introduced:

We added some more aggregations as part of the ongoing work, but did
not add them to the query string or corresponding models.

Relevant ticket(s):

* (GDT-128)[https://mitlibraries.atlassian.net/browse/GDT-128]

How this addresses that need:

This adds the new aggregations to the Enhancer and QueryBuilder models,
and adds them to the query in the TimdexSearch model.

Side effects of this change:

* VCR cassettes have been regenerated.
* In the filter partial, `to_sym` calls on the filter category have
been removed. These are no longer needed as all filter categories
are cast as symbols in the search controller.
* This is another instance of something that has come up recently:
the need to develop an E2E testing strategy for our Rails apps,
particularly those that are API consumers. We can test this using
our standard VCR process, but that is likely to break when
cassettes are regenerated and the search results change.
@jazairi jazairi temporarily deployed to timdex-ui-pi-filter-bug-o97gox March 7, 2024 17:14 Inactive
@jazairi jazairi merged commit 7164355 into main Mar 7, 2024
5 checks passed
@jazairi jazairi deleted the filter-bugfix branch March 7, 2024 17:15
@jazairi jazairi restored the filter-bugfix branch March 7, 2024 17:15
Copy link
Member

@matt-bernhardt matt-bernhardt left a comment

Choose a reason for hiding this comment

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

There's one change in here that I'm not sure I'm following (not because I anticipate a problem, I'm just not sure why it is happening) - I've noted that inline.

More generally, am I correct in thinking that these are things I should have included as part of #128 ?

@@ -1,17 +1,17 @@
<% return if values.blank? %>

<div class="category">
<button class="filter-label <%= 'expanded' if @enhanced_query[category.to_sym].present? || first == true %>"
<button class="filter-label <%= 'expanded' if @enhanced_query[category].present? || first == true %>"
Copy link
Member

Choose a reason for hiding this comment

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

I see us dropping the .to_sym method here, and I'm not sure why. I'm sure it makes sense - my first assumption is because the values aren't convertible to symbols now, but were before. I'm just not sure I'm following what changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I should've been clearer in the commit message. That to_sym call was there because SearchController#extract_filters didn't always cast the filter keys as symbols. I refactored that method to do so a while back, but noticed while debugging this that there were still a couple of to_sym calls. I removed them to make this less confusing for our future selves (hopefully), but it's unrelated to the additional/customizable filters changeset.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, gotcha - that makes sense. Thanks!

@jazairi
Copy link
Contributor Author

jazairi commented Mar 7, 2024

@matt-bernhardt Yes, this is related to #128. I ought to have mentioned it during code review but missed it at the time. I suspect that I was confirming functionality by click-testing contentTypeFilter and sourceFilter, which had already been set up. Regardless, something I should've caught as reviewer; my mistake!

@matt-bernhardt
Copy link
Member

No worries - I should have caught it as well. Thank you for catching it now, and for the hotfix :-)

matt-bernhardt added a commit that referenced this pull request Mar 12, 2024
** Why are these changes being introduced:

* The TIMDEX API has added support for a Places filter and aggregation,
  so the UI should be extended to take advantage of this.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/post-128

** How does this address that need:

* This builds on the work from #128 and #131, to include the Places
  feature in our displayed filters and aggregations.

** Document any side effects to this change:

* These changes will require that our test cassettes are re-generated,
  which will happen in the next commit.
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.

4 participants