-
Notifications
You must be signed in to change notification settings - Fork 4
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
T474 improve date created search #536
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Behavior in the UI looks great and is as described in the PR. Very nice!
I did pick up one error in the logs, which now seems to occur when doing a search with no date limit set:
F, [2024-04-04T16:42:13.709056 #749] FATAL -- : [ab5c4867-e814-4542-a662-cc52a92380e8]
F, [2024-04-04T16:42:13.709131 #749] FATAL -- : [ab5c4867-e814-4542-a662-cc52a92380e8] NoMethodError (undefined method `[]' for false:FalseClass):
F, [2024-04-04T16:42:13.709175 #749] FATAL -- : [ab5c4867-e814-4542-a662-cc52a92380e8]
F, [2024-04-04T16:42:13.709209 #749] FATAL -- : [ab5c4867-e814-4542-a662-cc52a92380e8] app/services/hyrax/search_service_decorator.rb:13:in `search_results'
It doesn't seem to affect anything in the UI, but maybe worth a look?
Also, wondering if it would be a lot of effort to make the results sortable by date created, once they've been filtered by the facet? Maybe for a future enhancement, if it looks like a lot of work.
@dolsysmith - Thanks for taking a look! I'll take a look at that error from the logs and see if I can find what's happening there. Re: sorting - I know that that's something doable via |
@dolsysmith - Can you explain what this file does? https://github.com/gwu-libraries/scholarspace-hyrax/blob/a2d57cfb4a552131c183150016b043cf8be4f38b/app/services/hyrax/search_service_decorator.rb I ask because that's where the error seems to be coming from, and I tried just commenting out the entire file for an experiment, and everything still seems to work (including sorting collections) - and that error message seems to not come up. |
If the works on a collections page (i.e., a view of the works in a single collection) are still sortable without it, then I guess we don't need it. I can take a look on Monday, too. The behavior it was intended to fix was that when viewing the works in a collection, changing the sort parameters had no effect. But I didn't write this patch, so I can't with confidence attest to its logic... |
Without the
Are you seeing the same? |
T527 collections page
@dolsysmith - interesting! I don't recall seeing that, but am going to look into this more today and will keep you updated. |
From the development logs, I think I've deduced that when running a search without a range limit set (or when removing range limit), a second query is run (perhaps to populate the range limit in the facets?), which looks something like this:
It's this second query that seems to trigger the error. When range limits are set, a single query seems to be run, and no error is triggered. Not sure what this means, but just sharing the clues as I find them... P.S. The range-limit controller code seems to be here. |
@alepbloyd Still working on this, but I think the problem may be that the Update: Noting the comment on the latter method:
Maybe the problem is that this method is getting triggered by something in a view? I'm suspecting now that this method shouldn't be getting called, at least not as it is, though I'm still piecing together where that call originates from. Another update The error is triggered by a specific route, |
I am now seeing that the search builder that the ranged search uses is an instance of I'm wrapping up for the day but can try this approach on Monday. |
Unfortunately, changing our search builder implementation to match the documentation more closely had no appreciable effect. |
@alepbloyd In addition to the patch, I removed a couple of lines from Please test thoroughly, i.e., in all search/faceting scenarios (collections, dashboard, within a collection, etc.). I didn't see any more errors, but since I had to modify the |
@dolsysmith - thank you! Testing this now. |
@dolsysmith - Tried searches in every context I could think of, and error seems to be gone! Search still works, new date indexing functionality is still working, and spec tests are still passing, so seems good by me. Thanks for the help in tracking that down. Should we do a squash 'n' merge on this? I get tripped up on what our process should be after merging in changes from |
I think squashing and merging should be fine. It should be mostly up to date with master because of the previous merge(s). |
Will close #474.
This PR changes:
Indexing behavior for works to add a
date_created_isim
solr field. TheGwIndexer
(inapp/indexers
) inherits default indexer behavior fromHyrax::WorkIndexer
, and the specific indexers (gw_etd_indexer
,gw_journal_issue_indexer
andgw_work_indexer
) inherit from GwIndexer, as we have all of the same indexing behavior for these. If in the future we need these types of works to be indexed differently, we can do that in each of these indexers individually.date_created_isim
field is generated with adding behavior togenerate_solr_document
in theGwIndexer
. Uses the Fedora objectdate_created
field and parses it into a four digit integer (year) format. Per previous discussions, if there are multiple values in thedate_created
field, this chooses the earliest valid option.Installs and configures blacklight_range_limit gem to add a "Date Created" field with a slider for selecting ranges. This can be styled further in the future.
Adds
GEONAMES_USERNAME
to the.env
configurations and uncomments it in thehyrax.rb
initializer. When I was reindexing everything, there was one work in particular that was causing an error due to something with the location field. Error message mentioned "geonames", found this line and uncommented it, made a Geonames account, and inserted my username (no keys/auth needed) and that seemed to fix it on future reindexing attempts?Commented out the
sort_catalog_spec
tests as they're super flaky and I need to take another pass at them, but they're just messing up CI/CD workflows at the moment.To test:
spec/features/gw_indexer_spec.rb
.ActiveFedora::Base.reindex_everything(batch_size: 5)
- the default batch size of 50 was causing my dev server to crash, but your mileage may vary./catalog
and verify that there is a "Date Created" facet with a slider bar, like screenshot.