Search returns results for empty search term when opened

Technical Support
  • I have enabled search button in navigation only for admins. When I click on button I get redirected to /search and it also returns search results for empty term - "".

    I've tried uninstalling and installing dbsearch plugin, restarted NodeBB and behavior is still the same.
    This bug occurs only on production, I have same settings on testing forum and it works properly. I'm using version 1.1.2.

    I have some custom CSS and following changes made both on testing and production sites:

    1. https://github.com/NodeBB/NodeBB/pull/5003/commits/fc68b64fe0565a9252c7f54a82b455f800658c97

    2. /nodebb/src/controllers/search.js file:
      http://pastebin.com/J4xPrrGL

    3. Custom header:

    <script>
    $(window).on('action:ajaxify.contentLoaded', function(){
      $('.page-category-480 [component="category/post"]').text('Click here to ask a question')
    })
    
    $(window).on('action:composer.loaded', function(event, data){
      // Get the composer elements.
      var comp = $('#cmp-uuid-' + data.post_uuid);
      var catlist = comp.find('.category-list');
      var title = comp.find('input.title');
      if (catlist.length) { // If there's no catlist, then the post is a reply.
        var defaultPlaceholder = title.attr("placeholder");
    
        // Update the placeholder if category is 480, else set it to the default.
        function updatePlaceholder() {
          if (catlist.val() === '480') {
            title.attr("placeholder", "Ask a question");
          } else {
            title.attr("placeholder", defaultPlaceholder);
          }
        }
        // Update placeholder each time the category changes, and once when loaded.
        catlist.change(updatePlaceholder);
        updatePlaceholder();
      }
    });
    $(document).ready(function() {
        $(window).on('action:ajaxify.end', function(ev, data) {
            $('.page-search #advanced-search button[type="submit"]').clone(true).appendTo('.panel-body.search-options');
        });
    });
    </script>
    

    Is there any existing cache for search terms? Perhaps hasn't been cleared properly? Otherwise I'm out if ideas what could be causing this kind of behavior.

  • @metalkramp is your site available to test? It's easier to debug directly.

  • Opening search seems to be searching for "" when using the nodebb-plugin-dbsearch plugin. Can't replicate on this community as solr plugin is used here instead.

  • Due to problems with dbsearch plugin mentioned above I switched to solr plugin. Seems to resolve problems that occured with dbsearch + solr gives better search results.


Suggested Topics


  • 0 Votes
    8 Posts
    2k Views

    Here you go.
    https://github.com/NodeBB/NodeBB/pull/5828
    After i slept on it, i changed position of hook so it works for both "delay loading" turned on and off. Original place was working only for delay loading turned on so it needed one more hook inside "unloadImages" function and i prefer solutions with less code.

  • Empty Homepage

    Technical Support
    0 Votes
    8 Posts
    2k Views

    Thanks, it looks like I'm back up and running. ✨

  • 0 Votes
    4 Posts
    1k Views

    UPDATE:

    The solution I've found for this problem is to run the following command inside the NodeBB installation folder

    git cherry-pick 1f3fa3a90f5fc02b3b2dc950b3a340c361206cef

    Doing so automatically merges the fixing commit without any further problems, making the Admin panel usable instantly after a NodeBB restart 🙂

  • 0 Votes
    1 Posts
    472 Views

    Hello and thanks for a great forum software!

    I've been playing with a docker hosted nodeBB instance, but all I'm getting from the docker hub is a v0.5 of NodeBB. Is there any reason the docker hub has such an old version? Can I avoid this somehow?

    Thanks!
    Tomas

  • 0 Votes
    3 Posts
    2k Views

    Thanks for that. I would expect some way to configure that. Removing that line would also apply that to all widgets areas, on all themes, right?

    My workaround is to add a plznohide class to the appropriate widget areas' divs and add this to either my theme CSS or the "Custom CSS":

    .hidden.plznohide { display: initial !important; visibility: visible !important; }

    It seems to work as expected. Being able to configure if each widget area should be hidden in the ACP would still be nice.