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.
Search returns results for empty search term when opened
-
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:
-
https://github.com/NodeBB/NodeBB/pull/5003/commits/fc68b64fe0565a9252c7f54a82b455f800658c97
-
/nodebb/src/controllers/search.js file:
http://pastebin.com/J4xPrrGL -
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 thenodebb-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.