Skip to content

Fix DefaultParametersListener and add Mink test#5013

Merged
demiankatz merged 2 commits into
vufind-org:release-11.0from
maccabeelevine:fix-default-parameters
Jan 28, 2026
Merged

Fix DefaultParametersListener and add Mink test#5013
demiankatz merged 2 commits into
vufind-org:release-11.0from
maccabeelevine:fix-default-parameters

Conversation

@maccabeelevine
Copy link
Copy Markdown
Member

@maccabeelevine maccabeelevine commented Jan 15, 2026

As far as I can tell, default parameters are not working at all. It seems that applying the command pattern to the search listeners in #1967 missed DefaultParametersListener.

As defined in searches.ini, this should work

;default_parameters[*] = "echoParams=none&debugQuery=false"
;default_parameters[search] = "sow=false"

@maccabeelevine
Copy link
Copy Markdown
Member Author

Before I fix the unit tests for this, and then rewrite both the listener and the tests for #4991, I would appreciate a sanity check that a) the feature is actually broken and b) it's worth fixing if no one has noticed since 2021. @EreMaijala ?

@maccabeelevine
Copy link
Copy Markdown
Member Author

b) it's worth fixing if no one has noticed since 2021.

I'm asking this partially because #4991 will require changing how the configuration of this feature works anyway -- JSON-style configuration instead of URL query parameters -- with a backwards compatibility layer. So if no one is currently using it but we do want to keep it, maybe I care less about building the backwards compatibility part.

@EreMaijala
Copy link
Copy Markdown
Contributor

@maccabeelevine You're right, it's totally broken. And I'm really surprised that nobody has noticed. But since it obviously hasn't worked for several years, maybe we could just fix it with #4991 without back-compatibility?

@demiankatz
Copy link
Copy Markdown
Member

Thanks, @maccabeelevine and @EreMaijala. I'd propose two possible paths forward:

1.) If the work here solves the problem and is nearly complete, I don't see harm in backporting it to the release-11.0 branch so we can have a fix sooner rather than later.

2.) If it would be significant effort to finish this up, and since no one is actually complaining, we could defer to #4991 as @EreMaijala proposes -- but if we do that, I think we should at least go to the effort of opening a JIRA ticket to document which versions are impacted by the bug, in case somebody notices in the future.

I slightly prefer option 1 since psychologically, I hate having known bugs sitting around in the code... but I'm willing to be pragmatic if letting this one go helps us make better progress in more important areas. :-) Let me know if you need my help with anything, whichever path you choose!

Comment thread module/VuFind/src/VuFind/Search/Solr/DefaultParametersListener.php Outdated
Copy link
Copy Markdown
Member Author

@maccabeelevine maccabeelevine left a comment

Choose a reason for hiding this comment

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

I decided to go ahead and fix the tests, since most of that work (changing to use command pattern) will have to be done later anyway if we're keeping the feature around.

No decision yet on how much backwards compatibility to maintain later, can defer that.

@maccabeelevine maccabeelevine marked this pull request as ready for review January 22, 2026 20:41
Copy link
Copy Markdown
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks, @maccabeelevine, this looks good to me and seems to be working as expected now. A few thoughts/questions:

1.) We should probably backport this to the release-11.0 branch. I can help if you want me to!

2.) I wonder if the unit test would be more readable if we broke the test cases down into smaller parts. Right now, some of the tests are testing multiple things, and it might not be too hard to break them down into separate functions for greater clarity. Not necessary or high priority, but if you're feeling a perfectionist streak, maybe worth considering.

3.) We should create a Mink test to confirm that this really works, since this is a perfect case of a unit test continuing to pass even though the integration was broken. Something simple, like setting the search default parameters to fq=id:testbug2 and then confirming that a blank search retrieves that one record might be an easy start.

Please let me know how you'd like to proceed; I can help with any part of this if you don't have time. In any case, thanks for catching and fixing this long-standing problem!

@maccabeelevine
Copy link
Copy Markdown
Member Author

maccabeelevine commented Jan 28, 2026

Thanks, @maccabeelevine, this looks good to me and seems to be working as expected now. A few thoughts/questions:

I refactored the unit test and wrote the simple mink test you suggested -- good call.

I tried the rebase but hit some merge errors, would not mind if you handle this one!

@demiankatz demiankatz force-pushed the fix-default-parameters branch from 0950ec1 to c70947a Compare January 28, 2026 16:50
@demiankatz demiankatz changed the base branch from dev to release-11.0 January 28, 2026 16:50
@demiankatz demiankatz added this to the 11.0.2 milestone Jan 28, 2026
Copy link
Copy Markdown
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks, @maccabeelevine, this looks great!

The conflicts you ran into were caused by Rector test improvements that were added to dev after the release of 11.0; I simply backported them into this branch since they're harmless changes.

I've also made a couple of minor tweaks to your Mink test -- your config setting was using bracket syntax, and I changed it to a real deeply-nested array for consistency; I also added an extra check to confirm that we're not only showing exactly 1 record but also that we're showing the expected record.

All of this gives me confidence that this is safe to merge. Thank you again!

@demiankatz demiankatz changed the title Fix DefaultParametersListener Fix DefaultParametersListener and add Mink test Jan 28, 2026
@demiankatz demiankatz merged commit 9db0c56 into vufind-org:release-11.0 Jan 28, 2026
6 checks passed
@maccabeelevine maccabeelevine deleted the fix-default-parameters branch January 28, 2026 17:46
ckaz pushed a commit to finc/vufind that referenced this pull request Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants