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

Search form click count defaults to "0" if empty, excluding new/unclicked links from results #3657

Closed
5 tasks done
madmaharaja opened this issue Oct 31, 2023 · 8 comments
Closed
5 tasks done
Labels
bug Something isn't working

Comments

@madmaharaja
Copy link

Code of Conduct

Submission validity

  • This is not a personal support request, that should be posted on discussions community.
  • I checked current issues and this request isn't a duplicate of an existing issue, opened or closed.

Self troubleshooting

Version

1.9.2

Description

The search function is giving me trouble. If I search for any given keyword that is either in the short link, in the original URL or in the title then in some cases no results are returned and sometimes a few (but not all existing) results are returned.

Here is a random example that I created to demonstrate the problem:
I created multiple entries with the keyword "abcdefg" in different fields:
grafik

When I search for "abcdefg" no results are found:
grafik

But as mentioned -- there are other keywords where a few results are found by the search but not all of the existing instances.

I have tested it by deactivating all plugins -- unfortunately with the same result.
Does anyone have an idea what the problem could be? Thanks for any suggestions!

Expectation

No response

Reproduction steps

No response

Context

No response

@madmaharaja madmaharaja added the bug Something isn't working label Oct 31, 2023
@dgw
Copy link
Member

dgw commented Oct 31, 2023

I have established that this feature is case-sensitive on my live instance of 1.9.2, though I don't believe this explains any of the missing example entries shown in the top screenshot.

However, the default search filter is more than 0 clicks. If I add a new link and don't click it, searching for that link by keyword only without modifying any other form fields does not in fact return it in the list.

Manually putting -1 in the click-count field returns results including the 0-click link as expected, and a form with the click-count field empty for further searches. However, submitting this new form with no value in the click-count makes it default to 0, filtering out the new link again.

Based on this, I will update the issue title with what I believe to be a concise description of the true bug.

@dgw dgw changed the title Search function not working properly Search form click count defaults to "0" if empty, excluding new/unclicked links from results Oct 31, 2023
@dgw
Copy link
Member

dgw commented Oct 31, 2023

It is possible to reproduce the behavior by visiting YOURLS_SITE . '/admin/?click_limit=' only. None of the other URL parameters are necessary to observe links with 0 clicks being filtered out of the results. That parameter being empty should mean no click limit (disabling the click-count filter), but seems to be interpreted as a limit of 0 instead.

@madmaharaja
Copy link
Author

madmaharaja commented Oct 31, 2023

Thanks for your quick reply!
I can confirm: When I manually enter "-1" in the click-count field, all the entries show up correctly in the search:
grafik

So, is there a way to change the default click limitation in the config.php?

@dgw
Copy link
Member

dgw commented Oct 31, 2023

The default is supposed to be '' (none). I did a little bit of poking around the code earlier to try and figure out what's going on, and didn't find anything yet. All the relevant code I examined appears to correctly interpret '' as "no limit", so I'm unsure where the empty parameter is somehow turning into a 0 equivalent.

This isn't something that should need configuring. It is indeed a bug that empty == 0; I just don't know where the bug is.

(The other people on YOURLS' maintenance team are much better at PHP than I am, so when they get a chance to look into this issue we'll surely have a better idea of what's going on.)

@sascha-hendel
Copy link

Noticed this issue, too.
I have a fresh installation of YOURLS done with composer.

Reason is a bug in file https://github.com/YOURLS/YOURLS/blob/master/includes/Views/AdminParams.php in function get_click_limit() (line 222-227). On inspecting the code I saw that my file is different than the master in github! The problem is already solved (use of empty() instead of isset() ) by this pull request: #3589 from July

I'm wonder, why my composer installation (installed 2 days ago) still contains this bug? The admin interface displays: Powered by YOURLS v 1.9.2

@dgw
Copy link
Member

dgw commented Dec 19, 2023

I'm wonder, why my composer installation (installed 2 days ago) still contains this bug? The admin interface displays: Powered by YOURLS v 1.9.2

1.9.2 released (was tagged) in March, and the patch was merged in July. There is not yet a YOURLS release tag containing this specific fix.

@YOURLS YOURLS deleted a comment from ThanhPhongPhan Dec 19, 2023
@sascha-hendel
Copy link

ok, but anyway this bug report can be closed now ;)

@dgw
Copy link
Member

dgw commented Dec 19, 2023

True! And it being fixed already in #3589 explains why I couldn't find where the value was mishandled earlier in this thread. :)

@dgw dgw closed this as completed Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants