Autocompleter plugin v 1.2

Autocompleter Plugin 1.2Hey guys,

today I’ve released a new version of the WordPress Plug-in “Autocompleter”.

What is the change?

The new version contains ability to display number of matches per word or phrase in the drop-down. The example is available in this blog (top/left search field). Of course in order to activate this you should go to Admin under the Settings section, where there is an option “Autocompleter” 🙂

Bear in mind that ‘number of matches’ are not the posts in the blog, but number of times where the tag or category is used. I would provide small example of this.

Let’s imagine that in your blog you have 3 posts all tagged with WordPress and one of them is in the WordPress category, while other 2 are in another category.

The result in matches for wordpress would be 4, because there are 3 tags attached to the posts and 1 of the posts is attached to the wordpress category. Hope this make sense to you.

There is also ability to change the word ‘matches’ with your own, or even word in your language.

If you want to play with position of the matches, you could change autocompleter.css from the plug-in directory.

That’s it. I hope you like this plug-in.

10 thoughts on “Autocompleter plugin v 1.2

  1. Daniel Hofstetter

    Nice plugin. However, it seems like there is a small bug: if I enter “da” in your search field it shows, among other results, “DateFormater 0 Matches” 😉

  2. Nik Chankov Post author

    Daniel, thanks.

    It’s not a bug. The plugin getting the data from a table which hold a ‘count’ column and that’s what I display. Probably this is atag which I’ve removed from a post, or something like this. In fact if you search for ‘DateFormater’ it will display ‘no results’, so the matches are shown correct. I know it’s logical to show only results which have more than 0 matches, but I will keep this way – what WP stores that’s what I will show.

    Anyway, thanks for the comment.

  3. Jean-Paul Horn

    Hi Nik,

    Very promising plugin, but I’d like to see an option to search in other content parts too instead of just the title. Is this possible? Also, I found a small bug during my testing: you forgot to accommadate those with a table prefix 🙂 (line 11 in values.php)

            $words = $wpdb->get_results("SELECT concat( name, '|', sum( count ) ) name, sum( count ) cnt FROM " .$wpdb->prefix. "terms t, " .$wpdb->prefix. "term_taxonomy tt WHERE t.term_id = tt.term_id AND name LIKE '$search%' GROUP BY t.term_id ORDER BY cnt DESC");
  4. Jean-Paul Horn

    Additional comment: is it possible to immediately fire the search once a user selects the appropriate term? (meaning: if you select the search term in the list box, don’t prefill the search box, but search immediately)

  5. Nik Chankov Post author

    you are right about the prefix. I totally miss that. I will add it.

    About search autosubmit, I think it’s possible and I will try to implement it.

    About search in “other parts” at this moment the script searches in the tag and categories table wp_terms. I prefer to keep it this way, because otherwise we will try to mimic the search functionality in autocomplete, the WP is heavy enough 🙂

  6. Jean-Paul Horn

    Nik Chankov :
    About search in “other parts” at this moment the script searches in the tag and categories table wp_terms. I prefer to keep it this way, because otherwise we will try to mimic the search functionality in autocomplete, the WP is heavy enough

    I understand, that’s why I asked for an additional option 🙂 I think it’s confusing to the end-user why the search results doesn’t reflect the actual number of posts with that search term (note: I also use the plugin ‘Results Count’ in search.php which shows how many search results match the keyword. So in this scenario the user sees 35 matches from autocomplete and 350 matches in the actual search results. Another point: the user might miss valuable content if they notice too few search results in autocomplete. If only three results matches the given keyword in tags and/or categories, but we have plenty of other posts in the database with that keyword, they will never see it because they won’t submit the search query due to the low number of matches.

    Does that make sense?

  7. Nik Chankov Post author

    I understand your point, but if you want something like this, just modify values.php file and try to make search in posts functionality. I am opened for proposals :), But speaking of your example, then it’s better to disable “number of matches”, or somehow to replace ‘matches’ with something more sensible. It’s up to you, but if you make something better I would definitely add to the plugin, no prob.

    And another thing – having Number or search results is basically the number of 1 search, while in autocompleter you should have one per each entry in the list which should be heavy.

    Anyway, as I said I am opened for proposals, so you are welcome 🙂

    About your other suggestions for autosubmit and the bug with prefix, I will commit into the svn shortly so they will appear as v1.2.1 very shortly.

  8. Kokteyller

    Hi Nik. First, thank you for this useful plugin. I want to ask something. While I use this plugin I got the W3 error like on this page based on a span tag. I found it in autocompleter.php file on line 53. After I deleted span tag, “x matches” started to view at the left side of the results. (left aligned). How can we fix this. I am sorry my bad English. Thanks in advance. Regards.

  9. Nik Chankov Post author

    Hi, as you know the tag make the “X matches” to go to the right side. The easiest way to make your code W3C compliant is to move this in an external JS file, but if you do this, then the the settings from the plugin cannot be used.

    My suggestion is to stop validating your code so much 🙂

  10. nomi

    Hello Nik,
    i really love your Plugin , i need your little help, can you please tell me that how to stop autocompleter to find title of every category ?? i’m using multiple categories those appears in autocompleter two times, and showing the tags too in autocompleter , i just wanna show tags in search to appear not the categories, is there anyway to get out this issue ?

Leave a Reply

Your email address will not be published. Required fields are marked *