Search not showing additional pages AND search dropdown selection issues.

david1pro Member
edited December 2022 in General support

Hello,

I discovered this with zpBootstrap, but changing to the built-in Zenpage theme produces the same results, so I don't think it's a theme issue.

If I click a tag link, and there are multiple pages of results, both infinite scroll and regular pagination works - it shows the additional pages appropriately.

However, if I do a Manual Search and there are multiple pages of results, whether using infinite scroll or regular pagination, clicking the second page results in an error. If using infinite scroll, it just says there are no more results, but if I switch to regular pagination, I get a 404 type error message:

Zenphoto Error: the requested object was not found.
Album: search/2

While it's not apparent in the error message, the URL does show the search term with the page number:
IE: (mysite)/search/2/?search=David

Further, if I start with a tag link, and then do Manual Search with only tags checked within that tag links' result, the URL will remain a tag URL and not a search URL and the more images/pagination links will work:

IE: 107 Hits for (2010-2019) AND (Christmas) with the URL of:
(mysite)/tags/%282010-2019%29+AND+%28Christmas%29/2/

However, if I select ALL in the what to search in dropdown rather than the default just tags for the "within" search, it will convert to a search URL and the more images/pagination links will NOT work. The URL in this case will be:
(mysite)/search/?search=%282010-2019%29+AND+%28Christmas%29

Finally, in troubleshooting this, I notice that searching "Titles" only in the dropdown does not limit to a titles only search and searching "Description" only does not limit a search to only descriptions, but both seem to be searching everything, as the number of results is the same as when everything being searched (and the results shown also show all results, whether the title or description alone has the search term).

Searching by "Date" only does not work correctly either, in the same manner, as it picks up all tags that have that number, even if the date of the picture is not the date searched (IE, searching for 2010 will give all results for pictures dated 2010-2019 in my setup, as those pictures have the TAG: 2010-2019, even though the individual pictures are dated by their individual year - this shows that the "Date" only search option is really searching the tags as well, as is the Title and Description options. - this makes this dropdown "what to search" feature useless.

I THINK the summary is: All tag searches will work correctly, and additional pages will show (this will be a /tags/ URL). ALL NON-TAG searches or searches that combine "Tags" and non-tags will not show additional pages (this will be a /search/ URL). Additionally, all non-tag search selections from the search dropdown (Title/Date/Description, etc.) will not limit themselves to those choices but will instead search everything.

These all seemed to work correctly in 1.5.9, from what I recall. Thanks in advance!

Comments

  • acrylian Administrator, Developer
    edited December 2022

    Finally, in troubleshooting this, I notice that searching "Titles" only in the dropdown does not limit to a titles only search and searching "Description" only does not limit a search to only descriptions, but both seem to be searching everything,

    The selection of fields to search is indeed broken. It is actually a known bug in 1.6 we didn't manage to fix (it was broken in 1.5.9 already). We needed to get general PHP 8 support out so there was no time and we decided to do that later.

    Search otherwise for me seems to work correctly otherwise being a full text search. I can't tell if zpBootstrap does anything differently regarding pages.

    Edit:

    The selection of fields to search is indeed broken.

    Referring to the selection on the search form. The search options itself do work.

  • Hi,

    I'm a bit confused by the response. At the very end, you said the search options itself do work. Do you mean the drop-down, where you choose what to search - Title, Date, Description, Pages, etc.? For me they do not, as no matter what you pick aside from "Tags," everything (including what you pick) will be searched. So for me, if I select "Pages" it should show only one result at most, as I have only one page, but when searching only "Pages" it shows that one page PLUS all images that also match the search term (I believe because they are tagged with the search term, even though I have specifically unchecked Tags) - so those images show up, even though they are not pages, which should be the only thing that shows up. But above the edit, you also said this is a bug, so I am not sure which it is. I could have sworn it worked correctly in 1.5.9, as I would choose pages and only my pages would come up... but I could be misremembering.

    Second, I want to be sure I am correct in saying that if I type in a search manually and select to search everything (so NOT only "Tags" or a direct tag link), if your results are several pages long, you can select each page and not get a 404 error, but the page actually shows. It shows a 404 for me after the first page, not only in zenBootstrap, but also in ZenPage, which is a default theme. If I search TAGS only, I don't have this issue. It is only for non-tag only searches.

    Just need clarification to know what is only occurring on my setup vs. yours as well. I know I did not have the pagination issue for non-tag-only searches in 1.5.9, and I didn't think I had the dropdown issue either, but in one spot you said it was a bug in 1.5.9, so I just want to be sure.

    Thanks for your time. It is appreciated.

  • acrylian Administrator, Developer

    I had edited my message to specify that I was referring to the search form field selector being broken. This was the case for 1.5.9 already and probably even older but no one noticed. We did also work on other search things because other stuff was broken as well.

    Those are just not used and instead the search option settings are used. Search options are as always to be found on Options > Search on the backend.

    Search with pagination does work for me on our own site (try searching for "images" for example). But also note there is a bug with the search cache that may cause trouble because somehow it may server outdated data which then causes even fatal errors (you should see that in your log though). So best disable it, it is optional anyway.

  • Thank you again.

    Sadly, I can't figure this out, on neither my Synology NAS, nor on the web with DreamHost, where the issue is the same. I even tried the following in this order: Set search cache expiry to 0. Clear search cache. Clear HTML Cache. Refresh Database. Rerun setup. Open site. Test - search pagination still does not work. Only tag only patination works. This is with every default theme, and I've done nothing except to zpBootstrap theme files (which shouldn't impact the untouched default themes)... so I don't know what's wrong.

    Debug logs show nothing either.

    Mystery, but thank you for attempting to help.

    One last question... since the dropdown selections of what to isolate a search to do not work, is there a way to make these selections go away? Seems silly to give front-end users a fictitious choice.

  • acrylian Administrator, Developer
    edited December 2022

    Weird, sadly no idea without any error since on our site it does work. Unless there is a detail missing to reproduce or we missed it.

    One last question... since the dropdown selections of what to isolate a search to do not work, is there a way to make these selections go away? Seems silly to give front-end users a fictitious choice.

    You can only hide it via CSS at the moment. That will/may change in the future - past 1.6.x - and probably it will be off by default.

    #searchextrashow { display: none; }

    This will also hide the radio box for "search within" as that is all one general element.

  • Thanks. The selection icon for the dropdown still shows, though the dropdown selections do indeed disappear. The new/within still shows, and works, so I'm fine with that. Any way to make the dropdown icon disappear?

  • fretzl Administrator, Developer

    .toggle_searchextrashow { display: none; }

  • Thanks, but the crippled icon is still there for me. The call for the search box in my template is...

    php printSearchForm('Search', 'search', null, null, null, null, null, null);

    ... so I wouldn't think I have anything overriding it, but nonetheless... something somewhere is in the zpBootstrap theme.

    1.6.1a doesn't like me as none of these issues impacted me in 1.5.9. I think I may have to learn to live with these issues for a while.

  • acrylian Administrator, Developer

    That's weird since there is only one search form. If you set both classes we mentioned above the selector should be gone.

    But it might be a zpBootstrap CSS ssue since it uses a CSS frame work that may override things. The hiding should be the last probably. Or your browser cache still plays tricks on you.

  • fretzl Administrator, Developer

    Sorry, for the zpBootstrap theme this should work:

    button.dropdown-toggle { display:none; }

    or

    comment line 200 in /js/zpBootstrap.js

    i.e this line: $('#searchextrashow').before('<button type="button" class="btn btn-default....etc

  • Thanks, fretzl. I would not have found that line in zpBootstrap.js. For now I have commented it and added a note to my site saying "Note: Due to a coding issue, manual searches will fail to show results past the first 100. Tag links do not have this issue."

    If anyone has a clue as to why manual searches show a 404 for additional pages of results, I'd be grateful! For my setups, this was not a problem in 1.5.9. I have no idea what has caused it - it occurs in zpBootstrap AND the default themes.

  • acrylian Administrator, Developer

    "Note: Due to a coding issue, manual searches will fail to show results past the first 100

    Just to clarify: 100 pages of results or 100 results itself? If I search on our site for "image" I get 3 album results and 110 image results on 12 pages.

  • david1pro Member
    edited January 2023

    Let's say I have 1000 images that have the name "David" in them. If I do a manual search for "David" I will initially get 100 images because my site is set to show 100 images at a time/per page... Then, I get links for the additional pages of results (or if using infinite scroll, I get the "view more images" button).

    My issue is... with that manual search, on the results page I will get "1000 Hits for David" and it will show the first 100 images. If I click to see page 2 (or any other page of the 10 pages of results), I will get a 404 error. If I have infinite scroll turned on, and I click the "View more images" link, it tells me "No more images to display"

    However, if I have 1000 images that are TAGGED "David" and I click the TAG LINK, the 1000 images will show, 100 at a time as they are supposed to, by either clicking links for each additional page (10 total pages with 100 images each), or if using infinite scroll, by clicking "view more images" one time, and then just scrolling after that, 100 images at a time... so the error is only on manual searches (or searches that are not tag-only searches).

    Albums that have more than 100 images also show correctly, by either clicking the page links or using infinite scroll.

    It is only manual non-tag-only searches that show a 404 after the initial page of results that have more than one page of results (in my case, more than 100 results)

    I hope this clarifies. And thanks for your help!

  • acrylian Administrator, Developer

    If using standard pagination, do you have the search query appended to the URL like /page/search/2/?search=somesearchterm?

  • Yes, as noted in my original post:

    While it's not apparent in the error message, the URL does show the search term with the page number:
    IE: (mysite)/search/2/?search=David

  • acrylian Administrator, Developer

    Okay, thanks. Sorry, your posts are partly quite long so asking was just quicker ;-)

  • Are there any more ideas here? I would very much like the additional pages of search (non-tag searches) to show up, rather than producing 404s. So far, the only way I can show additional search images is to increase the number of images per page, but having every page show a 1000 images to start, just so search results can be more thorough isn't really a solution.

    Thoughts?

  • acrylian Administrator, Developer

    Sorry, no more ideas since we cannot and actually never could reproduce your actual issue with further search pages.

    I don't think it makes a difference but try 1.6.1a. At least the search fields selector is fixed there now.

  • Thanks for your help. I was already on 1.6.1a, but I deleted and reinstalled everything. I still get 404 errors on all secondary manual search strings, regardless of theme, on both my NAS and Dreamhost. Guess I'm cursed.

  • acrylian Administrator, Developer

    I was already on 1.6.1a

    Note that there is no fixed 1.6.1a as it is still in development. Just in case…

    Did you disable the search cache or cleared it? If not try as sometimes that causes trouble.

    Otherwise I am sorry, I have really no idea why this happens for you…

  • I SOLVED THE NOT SHOWING ADDITIONAL PAGES ISSUE!

    I wanted to post this in case anyone else ran into this issue. On the rewriteTokens options, I had changed several options to shorten the URLs

    (IE: "SEARCH/tags" was change to just "tags" and "PAGE/gallery" was changed to just "gallery" and so on). (note the underscores from the options page don't show up when I type them here)

    One of my changes was "PAGE/search" - changed to just "search"

    As soon as I changed this back to "PAGE/search" the additional search pages now work. I've left the other shortened, as I don't think they've bothered anything, and it reduces my URLs by one /.../, but for the search results, this was throwing the error.

    Maybe my error will help someone else somewhere along the line.

    Hopefully someday the "The selection of fields to search is indeed broken" portion of my original problem will be solved, but for now, things are better for me.

Sign In or Register to comment.