1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Search Titles only does not work

Discussion in 'XenForo Questions and Support' started by hoangcyberchem, Nov 8, 2015.

  1. hoangcyberchem

    hoangcyberchem New Member

    The option of "Search Titles Only" does not work to me.

    For example: I search "cefuroxim" and check "Search Titles Only"
    http://thuocgoc.com/search/241/?q=cefuroxim&o=date&c[title_only]=1
    Received: The full search results.

    And is there any option that set this option "checked" as default.

    Many thanks!
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Setting it checked by default would be just be a case of modifying the "search" template, and adding 'checked="checked"' to the checkbox HTML.

    Does searching by titles work as expected for you on this forum? Are you using Enhanced Search or just the default XF search? Do you have any add-ons installed related to searching?
     
  3. hoangcyberchem

    hoangcyberchem New Member

    Thanks Chris D.
    Search by titles work fine on this forum (xenforo.com). I use the default XF search. I do not install any add-ons related to searching, but I do not know if I have done any mistake to the search function. How can I reset the search function without re-install the forum?
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    It's not really possible to cause a mistake with the search function, that said, it may well be worth rebuilding the search index.

    You can do that from Admin CP > Tools > Rebuild Caches > Rebuild Search Index.

    Ensure that (All) content types are selected and check "Delete the index before rebuilding".
     
  5. hoangcyberchem

    hoangcyberchem New Member

    It's the same after rebuilding the search index with your guide.
    I hereby attached the results when search "Cefuroxime" with check "Search Title only"
     

    Attached Files:

  6. Chris D

    Chris D XenForo Developer Staff Member

    Ah I see the problem now.

    There appears to be a mistake in your style. Have you edited the search_bar template?

    This line is what it should be in the normal default style:
    Code:
    <li><label><input type="checkbox" name="title_only" value="1"
    Based on what I can see on your site, this line is actually:
    Code:
    <li><label><input type="checkbox" name="title_only" value="0"
    Notice the value of 0 will effectively always mean the value of the checkbox will always be 0 regardless of whether it is checked or unchecked.
     
  7. hoangcyberchem

    hoangcyberchem New Member

    @Chris D : Really thanks for your support. It works as I expected now.
     
    Chris D likes this.

Share This Page