Support » Requests and Feedback » A better search?

  • I tried searching on these forums, but I can’t seem to find one. Is there a plugin/hack of sorts that returns some kind of useful search function? No offense, but unless you know the title of a blog post, WP’s search function is pretty useless.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hmm, thanks for pointing it out – that’s what I remembered seeing a while ago. Unfortunately, this doesn’t do much to solve the problems I was encountering. Seems like this hack just adds FULLTEXT search capabilities. I think I’ll go ahead and write my own little function to encorperate the stuff that I want in it 🙂 If I get somewhere with it, I might just release it as a plugin.
    If anyone’s wondering what I’m looking for, I wrote down a few notes last night:

    • Support for “+” (must have) and “-” (must not have)
    • Search title, content, excerpt, or comments (or any combination thereof)
    • Search within a date
    • Search for at least one word in phrase
    • Search exact phrase
    • Search for combinations of exact phrase and any words

    Mostly, the basic functionality of google searches. And of course, relevancy scoring (going to have to think about this one for a while).

    @brak, not sure if you’ll see this, but I’m currently looking for a search function that does what you’re describing (esp. AND searches), and I was just wondering if you’re still thinking of working on this. Or anyone else, for that matter.

    Same here. I am badly in need of a more sophisticated search engine. It should also be able to combine keywords (AND / + operator). It would also be nice if it could search the Category titles as well.

    If someone knows some code/plug-in that could achieve this, could you send me a note to bobob21 at


    WordPress is so in need of a new search function, it’s not even funny…

    Thanks, Michael, let us know when it’s ready :D.

    Hey, I do design. Trust me when I say you don’t want me to write core code for WP 🙂

    Related to this subject, I’m finding that searches on my site put the “best” results at the bottom of the search returns rather than at the top. This is strange. Has anyone experienced this same backwards results?

    I don’t believe they’re sorted by relevance, Lorelle. MySQL ain’t that good that I know of.

    Well, at least my searcher is consistent. The unrelated documents are consistently at the top and the most relevant documents are at the bottom of the results page. Consistently reversed. <sigh>

    livesearch integrated? or perhaps something more robust? Would be good to see more thorough, detailed, and specific searches being included, so this plugin might just do the job (if it is released as a plugin)

    the problem is with how WP constructs the search query… it’s bloody awful. It’s basically a glorified substring search.

    If I search for “rdp” I’ll get everything I posted where I mention WordPress because it contains that string (WordPress)

    I’m working on another search for my new theme, but it’s one of those back burner issues…

    * Support for “+” (must have) and “-” (must not have) => not yet, but planned
    * Search title, content, excerpt, or comments (or any combination thereof) => title and content; and excerpt in upcoming version (tomorrow)
    * Search within a date => that would be a filter post functionality, rather than a search post functionality
    * Search for at least one word in phrase => by default
    * Search exact phrase => exact word and exact phrase
    * Search for combinations of exact phrase and any words => yep, that too


    A simple fix to improve it slightly is to simply add a leading space to the SQL “LIKE” statement in wp/includes/classes.php around like 357:

    <code style=”white-space: pre;”>
    if (!$q[‘sentence’]) {
    $s_array = explode(‘ ‘,$q[‘s’]);
    $q[‘search_terms’] = $s_array;
    $search .= ‘((post_title LIKE ”.$n.” “.$s_array[0].$n.”) OR (post_content LIKE ”.$n.” “.$s_array[0].$n.”))’;
    for ( $i = 1; $i < count($s_array); $i = $i + 1) {
    $search .= ‘ AND ((post_title LIKE ”.$n.” “.$s_array[$i].$n.”) OR (post_content LIKE ”.$n.” “.$s_array[$i].$n.”))’;
    $search .= ‘ OR (post_title LIKE ”.$n.” “.$q[‘s’].$n.”) OR (post_content LIKE ”.$n.” “.$q[‘s’].$n.”)’;
    $search .= ‘)’;
    } else {
    $search = ‘ AND ((post_title LIKE ”.$n.” “.$q[‘s’].$n.”) OR (post_content LIKE ”.$n.” “.$q[‘s’].$n.”))’;

    It’s not exactly perfect, but it certainly makes the results more like what you would expect.

    Denis – that’s a great addition!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘A better search?’ is closed to new replies.