Plugin DB Search - Limitation?


  • I notice that the default setting when searching is topics which makes no sense to me what so ever. The default should be both topics and posts.

    Is there any way to change this behavior using this plugin or is there another plugin that would do this?

  • NodeBB

    You can do this in a plugin or custom javascript.

    require(['hooks'], function (hooks) {
      hooks.on('action:search.quick.start', function (params) {
       params.searchOptions.in = 'titlesposts';
      });
    });
    

  • @baris said in Plugin DB Search - Limitation?:

    require(['hooks'], function (hooks) {
    hooks.on('action:search.quick.start', function (params) {
    params.searchOptions.in = 'titlesposts';
    });
    });

    Hi, thank you, that would be great but it is not working.
    Default remains topics only. I need the default to be titles and posts.

  • NodeBB

    Ah my code only modifies the quick search in the header, if you want the same results when the form is submitted try the below.

    require(['hooks'], function (hooks) {
      hooks.on('action:search.quick.start', function (params) {
       params.searchOptions.in = 'titlesposts';
      });
      hooks.on('action:search.submit', function (params) {
        params.searchOptions.in = 'titlesposts';
      });
    });
    
  • Moved from General Discussion by  julian julian 

  • @baris said in Plugin DB Search - Limitation?:

    require(['hooks'], function (hooks) {
    hooks.on('action:search.quick.start', function (params) {
    params.searchOptions.in = 'titlesposts';
    });
    hooks.on('action:search.submit', function (params) {
    params.searchOptions.in = 'titlesposts';
    });
    });

    Nope, still does not work :).
    Other than putting it in the custom javascript area, is there something else I should do?

    After saving it there, I search for something that is in a post but the result only shows Titles.


  • @nodeham LOL, I didn't notice the 'activate' button at the bottom of the custom entry page.

    However, that didn't help. No results unless I then click on Titles and Posts.


  • Is there something else I need to do along with putting your code into the custom javasctipt?

  • NodeBB

    Nope that's it. I tried it on this forum and it works.

    The code I posted effects the search input in the header not the /search page. Maybe you are testing on that page?


  • @baris I'm testing from the magnifying glass on the top and from the search page itself. Since it works for you, I must have some sort of problem with a plugin or something else.

    I appreciate your help. Hope to get it working at some point.


  • I would really like to get this working.
    Does anyone have any thoughts on why this code above might not work?
    The board was converted from phpbb using a plugin. Is it possible that left something behind that is breaking the code shared above?

Suggested Topics

  • 2
  • 2
  • 5
  • 3
  • 1
| |