Better Search WordPress Plugin

Overview:

The default WordPress search is limited because it doesn’t give you results based on the title or content of the post, but by date.

Better Search replaces the default WordPress search engine with a more powerful search engine. Visitors will find more relevant search results of search terms. You can fine tune results by giving the title or the content more weighting.

Better Search supports templates for perfect integration into your blog template. Template for Twenty Eleven theme included in the package.

Additionally, the plugin will track the searches and allow you to present a “search heatmap” of the most popular searches. Support for WordPress widgets will allow you to easily add this heatmap to your theme’s sidebar or footer.

Features:

  • Automatic: Once activated, Better Search will automatically replace your default WordPress search with more relevant search results
  • Relevance: Search results are automatically sorted by relevance. You can also turn off relevancy based searching, in which case, results are sorted by date
  • Control the results: Fine tune the results by changing the weighting of post title and post content. Turn on BOOLEAN search to override the default NATURAL LANGUAGE search of mySQL
  • Popular searches: Find out what visitors are searching for on your blog. Display a list of popular search terms (daily and overall) on your blog in the form of a heatmap. Widget support for easy integration in your theme
  • Customisation: Support for a template file for perfect integration into your blog template. Alternatively, just input your own CSS styles in the Custom Styles tab in the Settings Page. Check the FAQ for more information
  • Supports cache plugins: Works with caching plugins like WP-Super-Cache and W3 Total Cache
  • Profanity filter: Customise the list of stop words that will automatically be filtered out of search queries
  • Translation ready: Better Search is translation ready. If you’re interested in translating Better Search into your own language let me know.

Requirements:

Installing

  1. Download Better Search.
  2. Extract the contents of better-search.zip to wp-content/plugins/ folder. You should get a folder called better-search.
  3. Activate the Plugin in WP-Admin.
  4. Goto Settings > Better Search to configure.
  5. Goto Appearance > Widgets to add the Popular Searches sidebar widgets to your theme

Options:

Below are screenshots of the default options available in the Settings screen

  1. better-search screenshot 1

    Options in WP-Admin - General options

  2. better-search screenshot 2

    Options in WP-Admin - Output options

  3. better-search screenshot 3

    Options in WP-Admin - Custom Styles

In order to display the most popular searches, you will need to add <?php if(function_exists('the_pop_searches')) the_pop_searches(); ?>.

In order to display the most popular searches weekly/daily, you will need to add <?php if(function_exists('the_pop_searches_daily')) the_pop_searches_daily(); ?>.

Alternatively, use the sidebar widget to display the overall or weekly top searches.

You can customize the output by adding a template file in your themes folder.

ChangeLog:

Latest version (1.3.2)

  • New: Profanity filter. Courtesy Banbuilders
  • New: Option to turn of the search results tracking. Ideal if you don't care about the popular search terms on your blog
  • New: Option to include the thumbnails in the search results
  • Modified: Search results now have better pagination. This is especially good when you have lots of search results - Thanks to J Norton for this feature
  • Modified: Plugin should now return results even if the search word is less than 4 characters
  • Fixed: Bug fixes - Thanks to Rich for some of the fixes

Read previous entries in the changelog.

Writing and testing plugins takes a good amount of time. If you like the plugin and find it useful and would like to donate something for my work please do click the Paypal Donate button below. The payment is secure. I haven’t filled in any amount. Feel free to donate what you please. Any amount is welcome. Thank you :)

License

All files and their contents are licensed under the GNU General Public License (GPL).

Questions or Bugs

Known Bugs

If you have any questions or would like to report any bugs, please see how you can get support.

Downloads

Download Better Search
Number of downloads: 23,837
Last updated: January 26, 2014
Page on WP Extend

83 Responses

  • Pingback: New WordPress Plugin: Better Search | Weblog Tools Collection

  • Hi there,

    Looks very promising. Is it possible to have it take on the existing Theme Style? How does one change the ‘style’ of the search results page?

    Regards,

    Ray

    Reply
  • It would save some headaches if the plug-in used the theme’s main page template instead of creating its own and hoping that just calling the header and footer will work.

    Reply
  • I’m not using widgets in my site, my sidebars are hard coded. How would I use this plugin?

    Reply
  • Pingback: Contextually search with Better Search WordPress plugin

  • WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '), INTERVAL 1 DAY)' at line 1]
    SELECT DATE_ADD(DATE_SUB(CURDATE(), INTERVAL DAY), INTERVAL 1 DAY)

    This is the error I get when I have both Popular and Weekly Popular Search widgets turned on and in the sidebar. Do, or should I give time for the weekly searches to populate? Is this why I am getting this error?

    Reply
  • Pingback: New WordPress Plugin: Better Search | Ajay - On the Road called Life

  • it would be great if the search did not include drafts in the results. i have a ton of posts i’m working on at any given time and they all show up in the search results.

    Reply
  • The results of my search are much better now! Thanks for that! :)

    The search results page is missing the <html>, <head> & <body>tags.

    Would love to see theme integration.

    Reply
  • Looks great Ajay, thanks. Going to give it a spin today.

    One feature I’d suggest is the ability to exclude certain pages or posts via the admin interface. This is really useful when you don’t want certain content to be found by users via site search.

    Reply
  • Very nice, but I have deactivated it. Hidden posts (set as “private”) are appearing as shortform in the results for everyone.
    This should only appear when logged in as admin (like in original WP-search).

    Reply
    • Thanks for pointing this out. I’ll put in the option to exclude private posts in the next version.

      Reply
      • Hi Ajay, the exclusion of private posts/pages (and drafts) should be set by default.
        the options may sound like this: “include drafts in search?” and a separated question: “include private posts in search?”.
        the same options with pages.

        Reply
        • Drafts are completed excluded in v1.1.

          I actually didn’t consider private posts, I’ll put that in the next version.

          BTW, when you say private posts, you mean those password protected right?

          Reply
          • In the menu for “publishing” an article or page after writing, there are three options: 1. public / 2. password protected / 3. private.
            The “private” postas/pages only might be seen from “logged in” users (admin, authors). Equaly it should be with the search results. The pass-protected posts/pages should be included in search, but only with the headlines and without shorttext (like in WP-original search). The “private” content have to be hidden from public users to keep privacy.
            This was sayed independantly from the options for inclusions/exclusions, you will give in future versions of “better search”. Many greetings from Austria!

          • If there are some open questions, it might depend on plugins, I am using for options with “private” content and handling of “pages” in search (and RSS): “Is Subpage Of”, “RSS Includes Pages” or others.

  • Hey,

    This is quite an interesting and unique plugin.
    Can you include an option to turn off “popular search” and an option to exclude pages (i.e. only search in posts, not pages)?

    Thanks.

    Reply
  • Pingback: Better Search v1.1 released | Ajay - On the Road called Life

  • Pingback: WordPress Plugin Releases for 03/23 | Weblog Tools Collection

  • Pingback: WordPress Plugin: Better Search | Blogging Pro

  • Pingback: Migliorare le ricerche in Wordpress | Napolux.com

  • Nice plugin.

    I`d like to request an enhancement. The relevance score isnt intuitive for users and i`d like to see an option to choose other ways of showing relevance like %, stars or anything else that`s more intuitive to understand.

    Relevance Score: 5.153

    Is that much or little ? Whats max ?

    Relevance Score: 75% is much easier to understand.

    John Myrstad

    Reply
    • I’m been thinking the same thing as well. I’ll need to study this a bit better. Alternatively, I’ll try a “relative” percentage basis for calculation.

      Reply
  • Pingback: Melhore os resultados de busca do WordPress | pBlog

  • It seems like search results show [shortcode] used in posts. Maybe they should be filtered out when not rendered ?

    John Myrstad

    Reply
  • Really like this plugin and giving it a test-drive on my local installation. Search results are way better then the defaults, however there are some points which would be nice if implemented.

    The layout of the search results (table | posts | footer) are still generated in the code. Would be nice if there could be some kind of callback feature where you can replace the output of a post with your own HTML, now you have to hardcode it in the plugin.

    Reply
    • This is actually a top priority list. Instead of a call back function, I plan on implementing Template Tags (or support for WordPress inbuilt Template Tags). I believe this is a lot easier to implement and understand for users.

      Reply
      • I have been modifying the plugin, particularly the foreach loop which displays all the posts, so it mimics as if it was in the_loop.

        This makes it much easier to work with as wordpress then has several functions available for displaying the posts.

        Reply
        • Hi Jan Jaap and Ajay,
          Jan Jaap, could you share your code with us? I’m very interested in how you did this! Maybe it is also a solution for the question by John Myrstad. I’m also stuck with the [shortcodes] issues.
          It looks to me that the_excerpt() handles those codes quite well by eliminating them, which is better than, well, showing the codes themselves :-)

          TIA,

          regards,

          Tom

          Reply
        • Thanks Jan. I’ll implement these changes after my tests into the next version of WP.

          Also internationalize the same accordingly.

          Reply
        • Thanx a million Jan Jaap and Ajay! I notice your alterations have some Dutch phrases… geen probleem! / no problem! :-) I’ll go check them out!

          Tom

          Reply
        • Hi,

          just implemented the plugin, with the alterations of Jan Jaap. It is in fact (I think) the solution to the question of John. At least it does the trick for me!

          One comment though: it is a bit unclear to me how the relevance is calculated. Sometimes when I perform a search, I’d expect some results coming up before others. But fair enough, I think it is way better than the original WP-search. Thanx again, Ajay for your good work, and Jan Jaap for your adjustments!

          Regards,

          Tom

          Reply
          • The relevance is a calculated by mySQL by matching the term with your content.

            I’ll be putting in Jan’s implementation the moment I find the time to update.

      • I have been modifying and stripping down this modification even further until I came up with the following version for my own website.

        Stripped version of better search

        Basicly what I did is use the filter functions of wordpress and replace the query for fetching the search posts with the one used in better-search plugin.

        Then if you are in the search.php file of your template you can still access the search score via $post->score.

        So again I want to thank you for releasing this great plugin as it improves search results quite a lot.

        Reply
  • Pingback: Entradas en las blogosferas.115, Carrero

  • Pingback: WordPress Plugin: Better Search | zooped.org

  • Pingback: WordPress Plugin Releases for 03/26 | Weblog Tools Collection

  • Hi,

    Nice plugin.

    My suggestion would be a way of turning off popular search/hot searches so that only the contextual search appears if that makes sense.

    Elliott

    Reply
  • Pingback: Improving WordPress Search : Update | Artiss.co.uk

  • Pingback: WordPress Plugin Releases for 04/02 | Weblog Tools Collection

  • Hi, thanks for a great plugin.
    Is there any way to limit the summary length in the search results, or eliminate the summary completely? Other options would be to display tags and categories, but these are somewhat addressed in comments above.
    Cheers

    Reply
  • First congratulations for this great plugin.

    Just a request. Can you create an option to enable/disable showing the daily/week/popular searches ?

    Because, I wanted to just show the Popular searches and was a war to do it :-) . I am almost sure that I messed up with the code. :-)

    Anyhow, thanks for this plugin.

    Best,
    Daniel

    Reply
  • Hi, great plugin! Congrats!

    I have a question, how I hide contact form (contact form 7- famous plugin) codes from search results?
    Ex: [contact-form 1 "contact"]

    Thanks.

    Reply
  • Can I exclude pages and search posts only?

    Reply
  • Pingback: Weblog Tools Collection: WordPress Plugin Releases for 05/05 « Internet Turnkey Websites

  • Thanks for a great plugin.

    I have one problem though and that is that I have a “members area” which “hides” some pages for unregistered, using User access manager (http://www.gm-alex.de/projects/wordpress/plugins/user-access-manager/).
    The “member” pages comes up in the search results, which is not good.
    Is there something I can do to exclude “member pages” in the search results?

    Reply
  • Pingback: Better Search bug-fix release | Ajay - On the Road called Life

  • Pingback: WordPress Plugin Releases for 06/13 | Weblog Tools Collection

  • Hello Ajay,
    It says i need to add the code

    I don’t know where? Is it at the function.php?

    Reply
  • Hello,

    I like the idea of using the fulltext option very much. Besides your plugin, only one other tried it before: wordpress.org/extend/plugins/spectacula-advanced-search/. In one respect it did it better, because it works with the default search template AND it automatically filters out any result that a certain user should not see. I think it just manipulates the original wordpress query. Reading the comments here, that is a main problem. And for me this are not only private posts, but also post marked by the User Access Manager plugin. So it would be very cool if your – in some respects more advanced – plugin would use this technique too.

    Some other things I really would like to see (sorry, I’m so greedy ;))
    - Support for Boolean Search (with sorting by relevance; I’ve got a solution I used years ago, see below)
    - Support for stopwords (you could use a gettext-string that lists language specific stopwords in a comma separated list and filter them out of the search query); I know you can use the MySQL options for that, but many people don’t have access to that setting
    - Check what minimum word length for fulltext queries is set > mysql_query(“show variables LIKE ‘ft_min_word_len’”) 0 ORDER BY relevance DESC;

    Here we artificially manipulate the relevancy score to give title more weight by multiplying by the constant 1.3. In the above query, it doesn’t seem to matter whether I have 3 fulltext indexes or just one comprising the title and text columns. From my testing, the results appear to be the same.

    Reply
    • By above query, do you mean the one by the plugin? I have noticed in my testing that the constant needs to be significantly higher because since titles usually have lesser content, the default weight of titles are much higher than the content.

      I have been debating adding in Boolean Search support. It’s most likely to be in a future version of the plugin.

      One thing that I have struggled with is getting better template integration. The issue is that I haven’t figured out a way to manipulate the template as well as maintain the same style of the theme.
      I am considering creating a “default” option that will just manipulate the WordPress query, but give you better customisation on the output if you choose to use the template file.

      Am not sure about stop words and minimum length. Do you see this being used often on your site?

      Reply
  • 1. Templating is nice but I’m almost completely sure people would find your plugin much much more useful if it’d just “replace” the default search with the advantage of better results but without the need to change a template. The other fulltext plugin does it somehow (I think with the wordpress function “add_filter”), but it’s no more maintained and officially not supporting the current wordpress version. I don’t know anything about writing wordpress plugins, but maybe this old plugin could give some clues…?

    2. Yes, weighting titles higher than content makes sense. There was something missing from my post, so that part didn’t make much sense. See next point…

    3. Adding Boolean search is pretty simple. Only still using weighting is a little bit tricky. And for some reason I only posted part of it and messed the example for ft_min_word_len in my comment. Should have been like that:
    >>>
    Boolean searching has two deficiencies: 1) results are not sorted by relevance and; 2) no method by which to weigh certain columns. There is a way around both of these problems. For example, if I have a table of articles and want to weigh the title more heavily than the text, I can do the following:

    S ELECT *, ( (1.3 * (MATCH(title) AGAINST (‘+term +term2′ IN BOOLEAN MODE))) + (0.6 * (MATCH(text) AGAINST (‘+term +term2′ IN BOOLEAN MODE))) ) AS relevance FROM [table_name] WHERE ( MATCH(title,text) AGAINST (‘+term +term2′ IN BOOLEAN MODE) ) HAVING relevance > 0 ORDER BY relevance DESC;

    Here we artificially manipulate the relevancy score to give title more weight by multiplying by the constant 1.3. In the above query, it doesn’t seem to matter whether I have 3 fulltext indexes or just one comprising the title and text columns. From my testing, the results appear to be the same.
    <<<

    4. The minimum length defines how short a word may be to be used for fulltext search. MySQL default is 4 characters, but you can change it. It's the option ft_min_word_len in the MySQL config; you can easily get the setting with php using mysql_query(“show variables LIKE ‘ft_min_word_len’”). A fulltext search for "Windows xp" would ignore "xp" because it is less than 4 characters. I guess you can see why it might be useful to allow mysql to search for short words.

    5. Stopwords are words that should be ignored in a query. Every language has words that don't really count for relevance. For the english language a (possible) list is here: http://www.textfixer.com/resources/common-english-words.txt. The easiest thing is to remove those word in php (it's also possible to give MySQL a stoppword list, but that requires direct access to these options). Assuming there was no minimal word length a query like "the search for a meaning" would find every post that has a "the", a "for" and an "a", besides the really meaningful words "search" and "meaning". Umm, hope this explanation isn't too gibberish.

    Reply
  • Is it possible to change the output from the text on the page to the page description?

    Reply
  • Can I use it along with Dave WordPress live search plugin?

    I mean your plugin and instant dropdown, results with Dave’s plugin should deliver more relevant results!

    Reply
    • You should be able to use it with Dave’s plugin. Better Search captures every search result, so if you use Dave’s plugin it should work

      Reply
  • Dean Hargreaves August 23, 2013 at 1:52 am

    Is there a way to make the better search also search specific categories from a drop down menu.
    Also how can I make it so that if I search for test it will still bring up results for tester.

    Thank You and brilliant plugin..

    Reply
    • Dean,

      There isn’t a feature in there to get a specific category search. It is on my to-do list of things to add to the plugin, but not with a confirmed deadline.

      You need to enable Boolean mode and then you can use * to run the query, e.g. test*
      I’m not sure if this works with normal mode i.e. without Boolean

      Reply
  • How can we change the colors displayed in the widget ?

    We get black for the biggest search (that’s OK) but a pale green for secondary searches (it’s not readable when your background is gray-blue).

    Our website is worticle.com if you need to watch it.

    How can we change the color displayed for the smallest searches in the widget ?

    Reply
  • I just installed ‘Better Search’. Thanks for the great post.

    Reply
  • Recently I tried better search. It did give better function than the original one, however, I came across a serious search “crack”. When you have a post titled “hydrochloride”, and you won’t get result if you search “chloride”, which is the right half of the full word, you will get nothing. Is this normal?

    Reply


Leave a Reply

%d bloggers like this: