Skip to:
Content
Pages
Categories
Search
Top
Bottom

Increase quantity of search results

  • @2cats

    Participant

    I am using WP 4.0.1 and bbPress 2.5.4; forums are for members only so I can’t send you a link. I have topics and replies set to show 20; this limitation is also applying to my search results, even if there are more than 20 results for a search term, when I search I am told I’m viewing 20 of 20 found, with no option to see anything more. Is there a way around this? Have I missed a setting, or is there a code snippet I can slip in somewhere? Ideally I’d get 20 results per page, with pagination and the total number of results found. Any help would be greatly appreciated!

Viewing 16 replies - 1 through 16 (of 16 total)
  • @robin-w

    Moderator

    Try adding this to your functions file

    function change_search() {
    $args['posts_per_page'] = 50
    return $args;
    }
    
    add_filter('bbp_before_has_search_results_parse_args', 'change_search' );
    
    

    where 50 is the number you want displayed

    I haven’t tested, if it doesn’t work come back and I’ll fix it

    @2cats

    Participant

    Thanks for your reply! Unfortunately it did not work (I added semicolon after 50; still no joy). This would be a great temporary fix; ideally I’d like to get search results with pagination, so I could have 20 per page but if someone really wanted to view ALL results they could. Thanks again!

    @robin-w

    Moderator

    hmmm….hadn’t fully reads your original post

    ideally Iā€™d like to get search results with pagination

    That’s what you should have ! Results should show the ‘replies per page’ setting together with full pagination.

    Are you sure there are more than 20 results to show?

    I suspect that something else is disturbing this

    If you haven’t amended bbpress code or added filters then :

    It could be a theme or plugin issue

    Plugins

    Deactivate all but bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    Themes

    If plugins don’t pinpoint the problem, as a test switch to a default theme such as twentytwelve, and see if this fixes.

    Come back when you have done that

    @2cats

    Participant

    Ah — thank you so much, I should have thought of that first thing. I did as you recommend, and the bug appears to be caused by the bbP Private Groups plug-in. When I de-activate it, I get the full results count (174 on my test) with pagination, as desired. I’ve got an inquiry in with that plug-in developer and hopefully I’ll get a fix, as the site members depend on the private groups function. Thank you again!

    @robin-w

    Moderator

    Slight problem is that I’m the plugin author of bbP Private Groups šŸ™‚

    Getting search to work with private groups drove me nearly mad – and I thought I’d cracked it, but clearly not šŸ™

    I’ll take another look at it – it was a while ago, and I’m always learning, so maybe a fresh look might fix any residual issues.

    When you say you get 174 results – are these all ones that someone logged in with restrictions would see? ie how may are you expecting based on only seeing some forums?

    @2cats

    Participant

    Hi Robin, well that works out nicely!
    So, I only see that I have 174 results (searching for the term ‘paper’) when bbP Private Groups is de-activated; with it activated (logged in as admin) I get 20 results; logged in a regular user without private forum access, I get 18 results. (1-18 of 18 total according to the count at the top.) The 174 results apply to both levels of users when bbP Private Groups is de-activated, because then both users have access to all the forums, private or not. Please let me know if there’s any additional information that I can provide. Thanks again!

    @robin-w

    Moderator

    I suppose I’m after

    logged in as full user with all forums 174 results
    Logged in as admin user – 20 results but should see all 174 – correct?
    Logged in as user able to see only public forums – 18 results but should see xx
    Logged in as a private user – xx results but should see yy results

    @2cats

    Participant

    So if I have bbP Private Groups de-activated, logged in as admin, or as a regular user without access to private groups, I see 1-20 of 174, with pagination to view all the results (since none of them are blocked from view for either user).

    With bbP Private Groups activated, as an admin I see 1-20 of 20 results (no pagination, no further results); as a regular user I see 1-18 of 18 results. I can’t filter out which of the 174 should be blocked as private to give you a count on how many the “regular” user should be seeing (unless you know a way to do this, I am happy to try).

    Thanks!

    @robin-w

    Moderator

    No that’s fine – do have a really large amount of topics/forums?

    I’ll take another look at the code

    @2cats

    Participant

    It’s a very active group — 19 forums altogether, 6 of which are private (all of them are members-only, not public); 2,956 topics and 12,424 replies to date.

    @robin-w

    Moderator

    ok, this has driven me mad again ! I hated search last time, and I hate it even more now šŸ™‚ – problem is that the results can be forums, topics or replies, and each one needs checking.

    BUT I have fixed the pagination.

    The downside is that searches will run slowly, as on each search I have to compile a full list of all forums, topics and replies that the user can see before running the search query. This takes time.

    Previously I had tried to just check the current page, but that is what led to the pagination problem.

    So can you try :

    http://www.rewweb.co.uk/private-groups-2-5-3/

    Follow the instructions, and confirm that this is working for you.

    Sorry, but I cannot see an easy way to speed up search, so it’s a trade off, slow search and private groups, or fast search and no private groups unless I have a brainwave in the next few hours.

    Anyway come back and let me know if this works on your site

    @2cats

    Participant

    Hi Robin,
    Thanks so much, this is an improvement, although as you noted it is very slow, and I am sure that I will hear complaints about that šŸ™‚ However it is better to get all of the results, and I will explain to folks that the forum is quite large and it’s a lot of data to search through. I am concerned about what will happen as the forum continues to increase in size, but this will work for the time being. Thank you again for being so responsive. I’m going to post it up live on Monday so that I’ll be around to monitor things.

    @robin-w

    Moderator

    great – glad it’s working.

    I did have an alternate faster solution which worked fine on my large test site UNLESS you hit the breadcrumb search after doing a search, when it ran out of memory! Go back to search via any other route and it was fine ! I’m still seeing if I can crack the issue with that (lots of resets) so I might come up with a faster solution.

    Let us know how you get on.

    If I don’t find a better solution in a few days, I’ll take that one live so that you get further updates via the usual route.

    @robin-w

    Moderator

    @2cats

    I often find when you leave a problem alone, the brain mulls it over in the background, so awoke in the middle of last night knowing what the issue was, so I have now fixed the problem with speedy searches !

    Can you try a new version of 2.5.3 beta, as before delete current plugin, download and add new

    http://www.rewweb.co.uk/private-groups-2-5-3/

    And let me know that this does what is expected !

    @2cats

    Participant

    Robin, this looks great! Search zips right along! I will load it up live tonight. Thank you SO MUCH!

    @robin-w

    Moderator

    No problem, glad to help and the plugin is improved !

Viewing 16 replies - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.
Skip to toolbar